Skip to content

Instantly share code, notes, and snippets.

@rherrick
Created December 8, 2017 01:07
Show Gist options
  • Save rherrick/9a9fca50ee7764a1cd2a434805f689ca to your computer and use it in GitHub Desktop.
Save rherrick/9a9fca50ee7764a1cd2a434805f689ca to your computer and use it in GitHub Desktop.
Simple configuration of Javadoc coverage doclet for Gradle
configurations {
// Other configuration lines might be in here
javadocCoverage
}
dependencies {
// Your application's other dependencies go here.
javadocCoverage "com.manoelcampos:javadoc-coverage:1.1.0"
}
// This generates the Javadoc coverage report into build/reports/javadoc/javadoc-coverage.html
task javadocCoverageReport(type: Javadoc, dependsOn: javadoc) {
source = sourceSets.main.allJava
destinationDir = reporting.file("javadoc")
options.docletpath = configurations.javadocCoverage.files.asType(List)
options.doclet = "com.manoelcampos.javadoc.coverage.CoverageDoclet"
}
// Optionally you can add the dependsOn here so that when you generate the javadoc
// jar, e.g. if you include the javadocJar in a publishing configuration, the javadoc
// coverage report will be generated automatically.
task javadocJar(type: Jar, dependsOn: javadocCoverageReport) {
classifier "javadoc"
from javadoc.destinationDir
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment