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.
Using Command Line Flags Task :compileTestJava > Task :processTestResources NO-SOURCE > Task :testClasses > Task :test > ... To skip any task from the Gradle build, we can use the -x or –exclude-task option. In this case, we'll use “-x test” to skip tests from the build.
If gradle --version works, but all of your builds fail with the same error, it is possible there is a problem with one of your Gradle build configuration scripts. You can verify the problem is with Gradle scripts by running gradle help which executes configuration scripts, but no Gradle tasks.
Gradle allows you to define one or more default tasks that are executed if no other tasks are specified. defaultTasks 'clean', 'run' tasks. register('clean') { doLast { println 'Default Cleaning! ' } } tasks.
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"]
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With