这是我的解决方案,它稍微简单一些:
// Create a list of subprojects that you wish to include in the jar. def mainProjects = [':apps',':core',':gui',':io']task oneJar( type: Jar , dependsOn: mainProjects.collect{ it+":compileJava"}) { baseName = 'name of jar' from files(mainProjects.collect{ project(it).sourceSets.main.output })}代码已在Gradle 1.12上进行了测试



