Skip to content

Commit 14a99b9

Browse files
Guard javadoc -Werror behind JDK 15+
The -Werror flag for the javadoc tool was added in JDK 15 (https://bugs.openjdk.org/browse/JDK-8232513). On older JDKs javadoc rejects the flag outright, which breaks any task that invokes javadoc (javadocJar, and therefore publishToSonatype / publishToMavenLocal) when Gradle is running on JDK 11. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent dce350c commit 14a99b9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

gradle/java.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ subprojects {
3333
javadoc {
3434
options.encoding = 'UTF-8'
3535
options.addStringOption('Xdoclint:reference', '-quiet')
36-
options.addBooleanOption('Werror', true)
36+
// -Werror for javadoc was added in JDK 15 (JDK-8232513). Skip on older JDKs
37+
// otherwise the javadoc task rejects the flag (breaks the JDK 11 publish job).
38+
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_15)) {
39+
options.addBooleanOption('Werror', true)
40+
}
3741
if (JavaVersion.current().isJava9Compatible()) {
3842
options.addBooleanOption('html5', true)
3943
}

0 commit comments

Comments
 (0)