Build combine jar out of subprojects

How can I include all output from submodules files into a jar?

At the moment I’m doing this:

task makeJar(type: Jar) {
    from files([":core", ":extensions:calculation", ":extensions:module2"].collect{ 
        project(it).sourceSets.main.output 
    })
}

My list of extensions is rather long, I would like to do something like:

task makeJar(type: Jar) {
    from files([":core", ":extension:*"].collect{ 
        project(it).sourceSets.main.output 
    })
}

/* or */
task makeJar(type: Jar) {
    from files(allprojects.collect{ 
        project(it).sourceSets.main.output 
    })
}

Is this possible?