Skip to content

Conversation

@jrepp
Copy link

@jrepp jrepp commented Nov 30, 2025

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)
Build fixes: - Update Gradle wrapper to 9.2.1 for Java 25 class file support - Add groovy-xml and groovy-swing dependencies for build-logic scripts - Fix Groovy 4.x imports (groovy.xml.XmlSlurper, groovy.xml.slurpersupport.GPathResult) - Fix Gradle 9.x task type API change in DistributionExtension - Add XmlParser import to idea.gradle for Gradle 9.x compatibility - Exclude .interp/.tokens files from groovydoc to avoid duplicates - Disable root project groovydoc due to antlr4 duplicate source issue
@jrepp jrepp changed the title Add Java 25 and Gradle 9.x build compatibility Add Java 25 and Gradle 9.x build compatibility for Groovy 4.0.x Nov 30, 2025
@paulk-asert
Copy link
Contributor

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.

@jrepp
Copy link
Author

jrepp commented Nov 30, 2025

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?

…mpts - groovy-xml already included in Gradle 9.2.1 - Replace SwingBuilder GUI with console-only fallback for signing credentials
- Add foojay-resolver-convention plugin for auto-provisioning JDKs - Support testJavaVersion property to select toolchain JDK for tests - Maintains backward compatibility with target.java.home property
- Run Gradle with JDK 21 (required for Gradle 9.x) - Use testJavaVersion property with foojay toolchain resolver - Tests run on JDKs 8-25 via auto-provisioned toolchains
@paulk-asert
Copy link
Contributor

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

@eric-milles
Copy link
Member

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.

Comment on lines -38 to -40
java-version: |
${{ matrix.java }}
17
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was designed to provide Java from the matrix list plus Java 17 for the main build. It already feeds Java 2x to the tests on line 44.

@paulk-asert
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants