def mergedCompileClasspath == null
project.sourceSets.each {
if (mergedCompileClasspath == null)
mergedCompileClasspath = it.compileClasspath
else
mergedCompileClasspath .plus(it.compileClasspath)
}
plus()方法不起作用。 compileClassPath是不可变的吗?如何创建一个空的文件集合?
您可以用一个空集合调用Project.files()
。
Project.files()
更新:
从Gradle 5.3开始,您还可以使用def emptyFileCollection = project.files([])
方法。
ObjectFactory.fileCollection()