Skip to content
Latchkey

gradle javadoc: Usage & Common CI Errors

Generate API docs - and tame doclint so warnings do not fail CI.

javadoc is the task added by the Java plugin that generates HTML API documentation for the main source set into build/docs/javadoc using the JDK’s javadoc tool.

What it does

javadoc runs the javadoc tool over your main sources. On modern JDKs the doclint checker is strict by default and treats malformed or missing doc comments as errors, which can fail the task in CI.

Common usage

build.gradle
./gradlew javadoc
// build.gradle: relax doclint
tasks.withType(Javadoc).configureEach {
  options.addStringOption('Xdoclint:none', '-quiet')
}

Common error in CI (and the fix)

Symptom: "javadoc: error - ... warnings" or "error: unknown tag" failing the javadoc task on a JDK that passed locally. Cause: a newer JDK’s doclint flags doc-comment issues as errors. Fix: fix the offending comments, or relax the checker by adding options.addStringOption('Xdoclint:none', '-quiet') (or -Xdoclint:all,-missing) to the Javadoc task configuration so it does not fail on doc warnings.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →