Skip to content

Fix Gradle 9 compatibility by using explicit Gradle 6.1.1 dependencies#6227

Closed
knutwannheden wants to merge 1 commit intomainfrom
gradle-fix
Closed

Fix Gradle 9 compatibility by using explicit Gradle 6.1.1 dependencies#6227
knutwannheden wants to merge 1 commit intomainfrom
gradle-fix

Conversation

@knutwannheden
Copy link
Copy Markdown
Contributor

Gradle 9 embeds Groovy 4.0.28, while RewriteGradleProject.groovy is compiled against Gradle 6.1.1 (Groovy 3.x). The Groovy version mismatch prevented proper type attribution during parsing.

Solution:

  1. Replace localGroovy() with explicit groovy-all:3.0.25 to maintain Groovy 3.x consistency
  2. Replace gradleApi() with explicit Gradle 6.1.1 module dependencies to avoid pulling in Gradle 9's API
  3. Add gradle-tooling-api:6.1.1 for GradleConnector support without Gradle 9's full API
  4. Change rewrite-gradle-tooling-model/model to use compileOnly(gradleApi()) to prevent leaking Gradle 9 API

Gradle 9 embeds Groovy 4.0.28, while RewriteGradleProject.groovy is compiled against Gradle 6.1.1 (Groovy 3.x). The Groovy version mismatch prevented proper type attribution during parsing.

**Solution:**
1. Replace `localGroovy()` with explicit `groovy-all:3.0.25` to maintain Groovy 3.x consistency
2. Replace `gradleApi()` with explicit Gradle 6.1.1 module dependencies to avoid pulling in Gradle 9's API
3. Add `gradle-tooling-api:6.1.1` for GradleConnector support without Gradle 9's full API
4. Change `rewrite-gradle-tooling-model/model` to use `compileOnly(gradleApi())` to prevent leaking Gradle 9 API
@timtebeek
Copy link
Copy Markdown
Member

I don't think we have any remaining Gradle 9 compatibility issues at the moment, also considering the recent Groovy 4:

@timtebeek timtebeek closed this Apr 1, 2026
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants