Skip to content

fix: improve Java 25+ Gradle compatibility check in Makefile#394

Merged
fglock merged 4 commits into
masterfrom
fix/java25-gradle-improved
Mar 27, 2026
Merged

fix: improve Java 25+ Gradle compatibility check in Makefile#394
fglock merged 4 commits into
masterfrom
fix/java25-gradle-improved

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Mar 27, 2026

Summary

Fixes #392 (reopened after initial fix)

This PR fixes the Java 25+ Gradle compatibility issue by directly modifying gradle-wrapper.properties instead of running the gradle command.

The Problem:
Users with Java 25+ and an older system Gradle (8.x from sdkman, Homebrew, etc.) cannot build because:

  1. Gradle 8.x cannot run on Java 25+ (class file version 69)
  2. Running gradle wrapper --gradle-version=9.1.0 fails because the old gradle crashes
  3. The cached gradle-8.x distributions cause further failures

The Solution:

  1. Direct properties file update: Use sed to update gradle-wrapper.properties instead of running gradle wrapper
  2. Cache cleanup: Clear both gradle-8.* and gradle-9.0* cache directories
  3. Use Gradle 9.1.0: Per official compatibility matrix, Java 25 requires Gradle 9.1.0+

Official Gradle Compatibility:

Java Version Gradle Required
Java 24 8.14+
Java 25 9.1.0+
Java 26 9.4.0+

Test plan

  • make clean && make passes on macOS
  • Ubuntu CI passes
  • Windows CI passes
  • User with Java 25 + old system gradle can now build

Generated with Devin

fglock and others added 4 commits March 27, 2026 19:51
More robust fix for #392:
- Always clear gradle-8.* caches when Java 25+ is detected
- Update all Gradle-dependent targets to use check-java-gradle
- Include clean, deb, test-unit, test-gradle-*, and sbom-java targets
- Better error messages when system gradle is not available
- Only attempt wrapper update if properties show Gradle < 9

The fix now handles the case where `make clean` is run first
(which was failing in the original report).

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Update check-java-gradle to extract both major and minor version numbers
- Properly compare versions to detect 9.0.x as insufficient for Java 25+
- Clear both gradle-8.* and gradle-9.0* cache directories
- Use Gradle 9.1.0 (first version with full Java 25 support)
- Update docs with official Gradle compatibility matrix

Fixes #392

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
On Windows CI, Make uses Git Bash, so ifeq($(OS),Windows_NT) branches
that use cmd.exe syntax fail. This change:
- Removes the ifeq/else/endif and uses bash syntax throughout
- Adds 2>/dev/null to numeric comparisons for portability
- Adds || true to optional cleanup commands

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The old gradle command (8.x) cannot run on Java 25+ due to class file
version 69. Instead of running `gradle wrapper --gradle-version=9.1.0`,
we directly update the distributionUrl in gradle-wrapper.properties
using sed. The wrapper script will then download the correct version.

This fixes the case where users have an old system gradle installed
(e.g., via sdkman) that crashes when running on Java 25+.

Fixes #392

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fglock fglock merged commit 73e29b6 into master Mar 27, 2026
2 checks passed
@fglock fglock deleted the fix/java25-gradle-improved branch March 27, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

problem building in Ubuntu

1 participant