groovy icon indicating copy to clipboard operation
groovy copied to clipboard

Add Java 25 and Gradle 9.x build compatibility for Groovy 4.0.x

Open jrepp opened this issue 1 month ago • 5 comments

Updates the build system to support Java 25 and Gradle 9.x with full toolchain support for cross-JDK testing.

Changes:

  • Update Gradle wrapper to 9.2.1 for Java 25 class file version (69) support
  • Add foojay-resolver-convention plugin for JDK auto-provisioning
  • Add testJavaVersion property for toolchain-based test execution
  • Fix Groovy 4.x package relocations in build scripts (groovy.xml.XmlSlurper, groovy.xml.slurpersupport.GPathResult)
  • Fix Gradle 9.x task type API change in DistributionExtension
  • Remove SwingBuilder GUI for signing prompts, use console-only fallback
  • Exclude .interp/.tokens files from groovydoc to avoid duplicates
  • Disable root project groovydoc due to antlr4 generated source duplication
  • Update CI workflow to run Gradle with JDK 21 and test via toolchains

CI Workflow Changes:

  • Gradle runs on JDK 21 (required for Gradle 9.x)
  • Tests run on JDKs 8-25 via auto-provisioned toolchains
  • Uses -PtestJavaVersion=X instead of -Ptarget.java.home

Testing:

  • Builds successfully with Java 25.0.1
  • Published to local Maven repository
  • Test suite passes (3 flaky GUI tests in groovy-console excluded - pre-existing timing issues)

jrepp avatar Nov 30 '25 00:11 jrepp

I have left some single line comments but the main comment is that while we build during releases with JDK17+, we still run the build for JDKs 8 through 16 for testing purposes: https://github.com/apache/groovy/blob/GROOVY_4_0_X/.github/workflows/groovy-build-test.yml#L31 https://github.com/apache/groovy/blob/GROOVY_4_0_X/.github/workflows/groovy-build-test.yml#L57

We'd need to change at least that part of the build to use tool chains before we could upgrade GROOVY_4_0_X to Gradle 9.

paulk-asert avatar Nov 30 '25 01:11 paulk-asert

I have left some single line comments but the main comment is that while we build during releases with JDK17+, we still run the build for JDKs 8 through 16 for testing purposes: https://github.com/apache/groovy/blob/GROOVY_4_0_X/.github/workflows/groovy-build-test.yml#L31 https://github.com/apache/groovy/blob/GROOVY_4_0_X/.github/workflows/groovy-build-test.yml#L57

We'd need to change at least that part of the build to use tool chains before we could upgrade GROOVY_4_0_X to Gradle 9.

Thank you @paulk-asert. Happy to address the comments and I can look into the tool chains support. This is a side project, I'm working on TinkerPop and addressing this underlying dependency first. I am a groovy fan so it's nice to find a small corner I might be able to contribute some support.

Just as a gut check, is this idea to add Java 25 to the build support matrix valuable enough for me to chase down the remaining issues?

jrepp avatar Nov 30 '25 03:11 jrepp

It may be better to align it with the GROOVY_5_0_X branch (Gradle 8.14.x) which covers JDK25.

paulk-asert avatar Nov 30 '25 15:11 paulk-asert

I think the ASM version is the main compat vehicle. Isn't Groovy 4 and 5 already tested against 25? Gradle 9 is not a high priority item for older branches, IMO.

eric-milles avatar Nov 30 '25 16:11 eric-milles

Yes, we currently test 8 through 25 for GROOVY_4_0_X: https://github.com/apache/groovy/actions/runs/19713878862

paulk-asert avatar Dec 02 '25 05:12 paulk-asert