问题
i try gradle -d compileJava
in my try project, and gradle raise "Skipping task ':compileJava' as it has no source files.". the worse thing is that i can't see anything created in build/. i create this project only with running gradle init
and creating a "src/Ex.java".
my question is:
How to load default "compileJava" or define my "compileJava" to fix this warning.
回答1:
By default, Java source files need to go into src/main/java
(or src/test/java
for test sources). Either adapt your directory structure accordingly, or reconfigure the source directory as follows:
sourceSets {
main {
java {
srcDirs = ["src"]
}
}
}
回答2:
You can also change gradle version to 4.8 in
gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
then do:
./gradlew build
来源:https://stackoverflow.com/questions/26634000/gradle-skipping-task-compilejava-as-it-has-no-source-files