How can I create aggregated javadocs?


(Gradle FAQ Bot) #1

How can I produce a combined set of javadocs for all of the subprojects in my build?


(Luke Daley) #2

To aggregate javadocs, you can create a javadoc task and add the source from the subprojects:

task javadoc(type: Javadoc) {
    source subprojects.collect { project ->
        project.sourceSets.main.allJava
    }
    destinationDir = new File(buildDir, 'javadoc')
}

If you are using some special javadoc processing tools and need to make the classpath of subprojects available to javadoc tool you can use something like:

task javadoc(type: Javadoc) {
    source subprojects.collect { project ->
        project.sourceSets.main.allJava
    }
    destinationDir = new File(buildDir, 'javadoc')
      // Configure the classpath
    classpath = files(subprojects.collect { project ->
        project.sourceSets.main.compileClasspath
    })
}

Combine javadocs from subprojects doLast