【发布时间】:2020-03-01 23:25:32
【问题描述】:
我有一个 gradle java 项目。我最近将我的源文件重新组织到了 dub 文件夹中。
原来我所有的源文件都在这个文件夹里……
project_root/src/main/java
现在我在...中有类 Foo.java
project_root/src/main/java/folderA
我在...中有类 Bar.java
project_root/src/main/java/folderB
Bar 依赖于 Foo。当我更改类 Foo 时,类 Bar 不会重新编译。因为 Foo 变了,类 Bar 应该有编译错误,但是没有命中。
我的build.gradle文件如下...
apply plugin: 'java'
// Use maven repository
repositories {
mavenCentral()
google()
}
dependencies {
implementation 'org.eclipse.jetty:jetty-servlet:9.4.19.v20190610'
implementation 'org.eclipse.jetty:jetty-client:9.4.19.v20190610'
implementation 'mysql:mysql-connector-java:8.0.16'
implementation 'org.apache.commons:commons-dbcp2:2.7.0'
implementation 'org.jdbi:jdbi3-core:3.10.1'
implementation 'com.google.firebase:firebase-admin:6.11.0'
compile 'com.google.apis:google-api-services-oauth2:v1-rev155-1.25.0'
// implementation 'com.google.gms:google-services:4.3.3'
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.0.1'
compile group: 'org.reflections', name: 'reflections', version: '0.9.11'
compile project('chesslib')
runtime files('../../chesslib/build/libs/chesslib-1.1.12.jar')
}
task runServer(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'ChessServer'
}
task runClient(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'ChessClient'
standardInput = System.in // without this, using Scanner on System.in won't work
}
task runCLITestApp(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'CLITestApp'
standardInput = System.in
}
【问题讨论】: