Q:

gradle: Skipping task ':compileJava' as it has no source files

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.

A:

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"]
        }
    }
}

