Can Gradle jar multiple projects into one jar ?
I know you can do it for a single project using a method like this:
task packageTests(type: Jar) {
Here's my solution, which is a little bit simpler:
// 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 })
}
Code has been tested on Gradle 1.12