Skip to content

Commit f16b533

Browse files
committed
Fix groovydoc task to skip when Java version is incompatible
- Skip groovydoc task when running with Java 17 (can't process Java 21 class files) - Make groovydocJar conditional on groovydoc being enabled - Fixes GitHub Actions build failure when building with Java 17 - Groovydoc still runs when using Java 21 (as expected)
1 parent 64c97bf commit f16b533

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,20 @@ task groovydocJar(type: Jar) {
9999
description = 'An archive of the GroovyDocs for Maven Central'
100100
archiveClassifier = 'javadoc'
101101
from groovydoc
102+
// Only create groovydocJar if groovydoc task is enabled
103+
onlyIf {
104+
groovydoc.enabled
105+
}
106+
}
107+
108+
// Skip groovydoc if Java version is incompatible with compiled classes
109+
// Java 17 can't process class files compiled with Java 21 (class file version 65.0)
110+
groovydoc {
111+
onlyIf {
112+
// Only run groovydoc if current Java version can process Java 21 class files
113+
// This prevents errors when building with Java 17 but classes were compiled with Java 21
114+
JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21)
115+
}
102116
}
103117

104118
artifacts {

0 commit comments

Comments
 (0)