On 19/10/2010, at 9:05 AM, Joern Huxhorn wrote:

> Hi,
> 
> is there an easy way to create sources and javadoc archives combining all 
> submodules?
> While I've created a large amount of fine-grained modules, I'd also like to 
> create a big javadoc file containing all documentation of all submodules, 
> especially since the documentation would be interlinked in that case.


Here's an example of how you might do it. This example assumes that there's no 
source code in the root project (just change subprojects to allprojects to fix 
that)

apply plugin: 'base'

task javadoc(type: Javadoc) {
    destinationDir = file("$buildDir/javadoc")
    source = files { subprojects.collect { it.sourceSets.main.java } }
    classpath = files { subprojects.collect { 
it.sourceSets.main.compileClasspath } }
}

task sourceZip(type: Zip) {
    classifier = 'source'
    from { subprojects.collect { it.sourceSets.main.allSource } }
}

task javadocZip(type: Zip) {
    classifier = 'javadoc'
    from javadoc.outputs.files
}


At some point I'd like to package this stuff up into some kind of 'aggregate' 
plugin. You'd apply the plugin to declare that the project is an aggregate of 
several others (not necessarily its subprojects). You'd end up with aggregate 
artifacts that combine the projects together: jar, javadoc, source, etc. 
Probably reporting too. And possibly some additional lifecycle tasks to manage 
them.


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to