gradle:如何删除中间子项目?

时间:2017-09-07 00:39:19

标签: java gradle

我有一个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

1 个答案:

答案 0 :(得分:0)

settings.gradle而不是

include testModules

尝试:

includeFlat testModules