evtdbw
Last Updated: February 25, 2016
·
3.77K
· gschueler
9922c7da66f6a50a5c9c417ebfb1064b

Aggregate Javadoc in multiproject Gradle builds

Here's a brief solution for how to use Gradle to generate all javadoc for a multiproject java build.

Add this to your top-level build.gradle:

apply plugin 'java'
def exportedProjects= [
        ":top-lib",
        ":sub:sub-api",
        ":sub:sub-lib1",
        ":sub:sub-lib2",
        ":sub:sub-lib3"
]

task alljavadoc(type: Javadoc) {
    source exportedProjects.collect { project(it).sourceSets.main.allJava }
    classpath = files(exportedProjects.collect { project(it).sourceSets.main.compileClasspath })
    destinationDir = file("${buildDir}/docs/javadoc")
}

Then run:

gradle alljavadoc
Say Thanks
Respond

1 Response
Add your response

22612
None

Recently I addes the lines to my gradle.build but it doesnt work
Im using classpath 'com.android.tools.build:gradle:1.2.3'

over 1 year ago ·