Skip to content

Make the build compatible with Gradle 9 - #12117

Draft
kiview wants to merge 2 commits into
mainfrom
gradle9-compat
Draft

kiview wants to merge 2 commits into
mainfrom
gradle9-compat

Conversation

@kiview

@kiview kiview commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Note

This is a first attempt at Gradle 9 compatibility. It touches the shading setup, so it's parked as a draft until after the next release.

The nightly "Update Gradle Wrapper" workflow fails on main because Gradle 9 no longer allows changing the usage of the api dependency scope:

Cannot change the allowed usage of configuration ':testcontainers-java:bom:api', as it was locked upon creation to the role: 'Dependency Scope'.

The cause is configurations.api.canBeResolved = true in gradle/shading.gradle. The changes below work on both 8.14.3 and Gradle 9. The wrapper bump is deliberately left out so the workflow can open it.

Main build

  • shading.gradle / publishing.gradle: resolve api through a new resolvableApi configuration that extends it, instead of making api resolvable. Replace ProjectDependency.dependencyProject with project.project(it.path).
  • japicmp.gradle: replace lenientConfiguration.getFiles() with a lenient artifactView.
  • core/build.gradle: idea.module.testSourceDirs → testSources.
  • build.gradle: gradle-lombok's DelombokTask calls the removed JavaExec.setMain, and the plugin is unmaintained. Replace the task with a plain JavaExec that does the same thing.
  • ci-support.gradle: turn off Gradle 9's new failOnNoDiscoveredTests check for the testMatrix no-op test executor.

Examples

The Spring Boot 2.7 and Kotlin 1.8 Gradle plugins use APIs removed in Gradle 9. spring-boot and spring-boot-kotlin-redis move to Spring Boot 3.5.16 and Kotlin 2.4.21 (jakarta imports, spring.data.redis.*, Java 17). This is a separate commit and can be split out.

Verification so far

Tested locally with JDK 21 on Gradle 8.14.3 and 9.8.1:

  • testMatrix, japicmp, jarFileTest and javadoc pass on both versions, as do examples and smoke-test checks and the Spring Boot example tests.
  • All generated POMs are identical before and after the change.
  • Shadow jar file lists for core, couchbase, azure and postgresql are identical.

Still to do before merging: compare the contents of every module's shadow jar (per-entry checksums) between main and this branch.

🤖 Generated with Claude Code


This PR description was written and published by Claude (Opus 5.5) on behalf of @kiview.

Summary by CodeRabbit

  • Examples and Compatibility
    • Spring Boot examples now use Spring Boot 3.5 and Kotlin 2.4, target Java 17, and follow current Jakarta Persistence and Redis configuration conventions.
  • Build and Test Compatibility
    • Updated build and test behavior for compatibility with newer Gradle versions, including Gradle 9.

kiview and others added 2 commits October 17, 2026 21:08
Gradle 9 no longer allows changing the usage of the `api` dependency
scope, which broke the nightly wrapper update. Resolve `api` through a
dedicated resolvable configuration instead, and replace other APIs
removed in Gradle 9 (JavaExec.main via gradle-lombok's DelombokTask,
ProjectDependency.dependencyProject, LenientConfiguration.getFiles,
IdeaModule.testSourceDirs). Also disable the new failOnNoDiscoveredTests
check for the testMatrix no-op executer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Spring Boot 2.7 and Kotlin 1.8 Gradle plugins use APIs removed in
Gradle 9.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1708a3bd-927d-4acf-9dca-ae6c8c239381
📥 Commits

Reviewing files that changed from the base of the PR and between a8be77b and 93bcee7.

📒 Files selected for processing: 11
  • build.gradle
  • core/build.gradle
  • examples/spring-boot-kotlin-redis/build.gradle.kts
  • examples/spring-boot-kotlin-redis/src/test/kotlin/com/example/redis/AbstractIntegrationTest.kt
  • examples/spring-boot/build.gradle
  • examples/spring-boot/src/main/java/com/example/DemoEntity.java
  • examples/spring-boot/src/test/java/com/example/AbstractIntegrationTest.java
  • gradle/ci-support.gradle
  • gradle/japicmp.gradle
  • gradle/publishing.gradle
  • gradle/shading.gradle

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

📝 Walkthrough

The pull request updates Gradle task configuration and API dependency resolution. It also updates two Spring Boot examples, including framework and Kotlin versions, Java compatibility, JPA imports, and Redis property keys.

Changes: Gradle build tooling

Layer / File(s) Summary
Gradle task configuration
build.gradle, core/build.gradle, gradle/ci-support.gradle, gradle/japicmp.gradle
The delombok task now uses JavaExec. IntelliJ test sources use testSources.from(...). Gradle 9+ test-matrix tasks allow no discovered tests, and the japicmp task checks files in a lenient artifact view.
Resolvable API dependencies
gradle/shading.gradle, gradle/publishing.gradle
Shading and POM generation resolve API dependencies through resolvableApi. Project dependencies are looked up by path in shading logic.

Spring Boot examples

Layer / File(s) Summary
Java example migration
examples/spring-boot/build.gradle, examples/spring-boot/src/main/java/com/example/DemoEntity.java, examples/spring-boot/src/test/java/com/example/AbstractIntegrationTest.java
The Spring Boot plugin version changes to 3.5.16. JPA imports use jakarta.persistence, and Redis properties use the spring.data.redis prefix. The JUnit launcher dependency no longer pins a version.
Kotlin Redis example migration
examples/spring-boot-kotlin-redis/build.gradle.kts, examples/spring-boot-kotlin-redis/src/test/kotlin/com/example/redis/AbstractIntegrationTest.kt
The build updates Spring Boot and Kotlin versions, targets Java 17, and configures compiler options through kotlin.compilerOptions. Redis properties use the spring.data.redis prefix, and the JUnit launcher dependency no longer pins a version.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: eddumelendez

Merge Risk: ⚪ Minimal · up to 93bce

The Gradle and Spring Boot compatibility changes have no identified outstanding failure, and the dependency-resolution concern is refuted. No actionable merge risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 4 files. (7 skipped: 7 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title is concise and accurately summarizes the primary change: making the build compatible with Gradle 9.
Description check Passed The description clearly explains the Gradle 9 failure, the affected build changes, example updates, verification performed, and remaining validation work. It provides sufficient context and follows th…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description clearly explains the Gradle 9 failure, the affected build changes, example updates, verification performed, and remaining validation work. It provides sufficient context and follows the repository’s descriptive requirements.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 4 files. (7 skipped: 7 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant