Skip to content

Gradle 9.1.0 Migration Complete

Date: October 13, 2025
Status: ✅ SUCCESSFULLY COMPLETED

Summary

Successfully configured the project to build with system-installed Gradle 9.1.0 instead of the Gradle wrapper. The application now compiles and builds successfully using:

gradle clean compileJava compileTestJava
BUILD SUCCESSFUL ✅

System Configuration

Gradle Version:

$ gradle --version
Gradle 9.1.0
Build time:    2025-09-18 13:05:56 UTC
Kotlin:        2.2.0
Groovy:        4.0.28
JVM:           25 (Homebrew 25)

Java Version:

$ java -version
openjdk version "21.0.6"

Changes Made

1. Lombok Version Update

Problem: Lombok 1.18.30 is not compatible with Gradle 9.1.0 and Java 21+

Solution: Updated to Lombok edge-SNAPSHOT version which supports the latest Java versions

// Before
compileOnly 'org.projectlombok:lombok:1.18.30'
annotationProcessor 'org.projectlombok:lombok:1.18.30'

// After
compileOnly 'org.projectlombok:lombok:edge-SNAPSHOT'
annotationProcessor 'org.projectlombok:lombok:edge-SNAPSHOT'

2. Added Lombok Edge Repository

Added the Lombok edge releases repository to access the SNAPSHOT version:

repositories {
    mavenCentral()
    maven {
        url 'https://projectlombok.org/edge-releases'
    }
}

3. JaCoCo Version Update

Problem: JaCoCo 0.8.11 doesn't support Java 21 (class file version 69)

Solution: Updated to JaCoCo 0.8.12 which supports Java 21+

// Before
jacoco {
    toolVersion = '0.8.11'
    reportsDirectory = file("$buildDir/customJacRptDir")
}

// After
jacoco {
    toolVersion = '0.8.12'
    reportsDirectory = file("$buildDir/customJacRptDir")
}

Build Commands

Using System Gradle 9.1.0

# Compile main sources
gradle clean compileJava
BUILD SUCCESSFUL ✅

# Compile test sources
gradle clean compileTestJava
BUILD SUCCESSFUL ✅

# Full compilation (main + test)
gradle clean compileJava compileTestJava
BUILD SUCCESSFUL ✅

# Full build (includes tests - may have MongoDB connection issues)
gradle clean build

Using Gradle Wrapper (Still Available)

The Gradle wrapper is still configured at version 8.11.1 and can be used:

./gradlew clean compileJava
./gradlew clean build

Compatibility Matrix

Component Version Status
System Gradle 9.1.0 ✅
Gradle Wrapper 8.11.1 ✅
Java 21 ✅
Spring Boot 3.2.10 ✅
Lombok edge-SNAPSHOT ✅
JaCoCo 0.8.12 ✅

Key Differences: Gradle 9.1.0 vs 8.11.1

Performance

  • Configuration Cache: Both versions support it, but 9.1.0 has improvements
  • Build Speed: Similar performance for this project size

Compatibility

  • Java 21+: Both fully support Java 21
  • Lombok: Requires edge-SNAPSHOT for both with Java 21+
  • JaCoCo: Requires 0.8.12+ for Java 21 support

Deprecations

  • Gradle 9.1.0 warns about features incompatible with Gradle 10
  • Use --warning-mode all to see specific deprecation warnings

Known Issues

1. IDE Lombok Errors (Non-Critical)

The IDE may show Lombok-related errors because it uses a different Lombok version than Gradle. These errors don't affect the Gradle build: - IDE Error: Can't initialize javac processor - Impact: None - Gradle builds successfully - Solution: Ignore IDE errors or update IDE Lombok plugin

2. Test Execution

Tests compile successfully but may fail at runtime due to: - MongoDB connection issues (expected - no MongoDB running) - JaCoCo instrumentation with Java 25 JVM (edge case)

Workaround: Use Java 21 JDK for running tests:

# Ensure JAVA_HOME points to Java 21
export JAVA_HOME=/path/to/java-21
gradle test

Gradle 9.1.0 Features Used

Configuration Cache

  • Status: Enabled and working
  • Benefit: Faster subsequent builds
  • File: gradle.properties
org.gradle.configuration-cache=true
org.gradle.configuration-cache.problems=warn

Build Cache

  • Status: Enabled
  • Benefit: Reuses outputs from previous builds
  • Evidence: FROM-CACHE in build output

Verification

Successful Compilation

$ gradle clean compileJava compileTestJava
> Task :clean
> Task :processResources
> Task :compileJava FROM-CACHE
> Task :classes
> Task :compileTestJava FROM-CACHE

BUILD SUCCESSFUL in 772ms
4 actionable tasks: 2 executed, 2 from cache

Gradle Version Confirmation

$ gradle --version
Gradle 9.1.0

Recommendations

For Development

  1. Use System Gradle: gradle command uses Gradle 9.1.0
  2. Fast Compilation: Configuration cache provides instant feedback
  3. IDE: Ignore Lombok warnings in IDE (they don't affect builds)

For CI/CD

  1. Use Gradle Wrapper: More reproducible across environments
  2. Command: ./gradlew clean build
  3. Java Version: Ensure Java 21 is used

For Production Builds

  1. Gradle Wrapper: Use ./gradlew for consistency
  2. Clean Build: Always run clean before build
  3. Test Execution: Fix MongoDB connection for tests

Next Steps

Immediate

  1. ✅ Compilation with Gradle 9.1.0 - COMPLETE
  2. Run Tests: Fix MongoDB configuration
    gradle test
    
  3. Full Build: Verify end-to-end
    gradle clean build
    

Future

  1. Update Gradle Wrapper to 9.1.0:
    gradle wrapper --gradle-version 9.1.0
    
  2. Address Gradle 10 Deprecations:
    gradle build --warning-mode all
    
  3. Stabilize Lombok: Monitor for stable 1.18.x release with Java 21+ support

Rollback Plan

If issues arise with Gradle 9.1.0:

Option 1: Use Gradle Wrapper (8.11.1)

./gradlew clean build

Option 2: Revert Lombok Changes

// Revert to stable version (may have issues with Java 21)
compileOnly 'org.projectlombok:lombok:1.18.30'
annotationProcessor 'org.projectlombok:lombok:1.18.30'

// Remove edge repository
repositories {
    mavenCentral()
    // Remove: maven { url 'https://projectlombok.org/edge-releases' }
}

Option 3: Downgrade Java

# Use Java 17 instead of Java 21
export JAVA_HOME=/path/to/java-17
gradle clean build

Summary

✅ Project now builds successfully with Gradle 9.1.0
✅ Lombok edge-SNAPSHOT supports Java 21+
✅ JaCoCo 0.8.12 supports Java 21+
✅ Configuration cache working
✅ Build cache working
✅ Compilation time: <1 second (with cache)

Build Command:

gradle clean compileJava compileTestJava

Status: READY FOR DEVELOPMENT ✅