问题描述
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".
我的问题是:
如何加载默认的 compileJava或定义我的 compileJava以解决此警告。
How to load default "compileJava" or define my "compileJava" to fix this warning.
推荐答案
默认情况下,Java源文件需要放入 src / main / java
(或 src / test / java
作为测试源)。要么相应地调整目录结构,要么重新配置源目录,如下所示:
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"]
}
}
}
这篇关于gradle:跳过任务“:compileJava”,因为它没有源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!