我有一个gradle项目,我想将所有子项目存储在一个目录中:testing
。我的文件结构是:
├── build.gradle
├── gradle
│ └── wrapper
├── settings.gradle
└── testing
├── A
│ └── build.gradle
└── B
└── build.gradle
我的settings.gradle
添加了这些子项目:
def testingDir = 'testing'
def absolutePath = rootDir.getAbsolutePath()
def testModules = new File(absolutePath + '/' + testingDir).list()
.each {println it}
.collect{testingDir + ':'+it} as String[]
include testModules
但是当我运行./gradlew projects
时,它会正确打印子目录,但会将testing
报告为子项目之一:
A
B
:projects
------------------------------------------------------------
Root project
------------------------------------------------------------
Root project 'my-project'
\--- Project ':testing'
+--- Project ':testing:A'
\--- Project ':testing:B'
问题是:为什么testing
是一个子项目以及如何摆脱它?
Gradle 3.3
答案 0 :(得分:0)
在settings.gradle
而不是
include testModules
尝试:
includeFlat testModules