0
我有以下简单的设置会自动包含父文件夹的子项目:为什么gradle产出增加一个子文件夹时,作为子项目
文件结构
$ tree
.
├── build.gradle
├── modules
│ ├── rest-model
│ └── rest-resource
└── settings.gradle
文件内容
设置。 gradle
def MODULES = 'modules'
file(MODULES).eachDir {
include ":${MODULES}:${it.name}"
}
的build.gradle
task hello {
doLast {
subprojects.each {
println it.name
}
}
}
任务hello
上面会打印出所有子项目。我期待只有两个子项目:rest-model
和rest-resource
。但是,我得到三个:modules
,rest-module
和rest-resource
。这里是gradle输出:
$ gradle hello
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :hello
modules
rest-model
rest-resource
BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
那么,为什么gradle会自动将父文件夹模块作为子项目?我可以预防吗?