openrewrite / openrewrite/rewrite

Gradle 9.x: recipes for new 9.1–9.6 deprecations

Open
#7,986 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

gradle recipe
Dominant language
Java
Stars
3.7k
Forks
570
Avg merge
13h 12m
Merged PRs (30d)
261

Description

Background

Gradle 9.x has introduced a number of new deprecations across minor releases (9.1–9.6), documented in the Gradle 9.6 upgrade guide. Several of these are mechanical DSL/API rewrites that are good candidates for OpenRewrite recipes and could be added to org.openrewrite.gradle.MigrateToGradle9.

This issue tracks candidate recipes for the new 9.2–9.6 deprecations.

Already covered in MigrateToGradle9

  • 9.1 multi-string / map dependency notation → DependencyUseStringNotation
  • 9.1 one declaration per statement → gradle9.OneDependencyDeclarationPerStatement
  • JavaPluginConvention removal (top-level sourceCompatibility/targetCompatibility) → gradle9.UseJavaExtensionBlock
  • mainClassNamemainClassgradle9.UseMainClassProperty(ForApplication)
  • version = { } → closure form → gradle9.UseVersionClosure
  • spread *configurations.allgradle9.RewriteSpreadAllInConfigurationsBlock

New recipe candidates (mechanical, good fit)

High value:

  • Current-project dependency: module coordinates → project(":x") (9.3) — replace group:name:version referring to the current project with project() notation — gradle9.UseProjectDependencyInsteadOfModuleCoordinates (#7989)
  • Project object as dependency notation → project(":x") (9.6)
  • DomainObjectCollection.findAll(Closure)matching(Spec) (9.4) — gradle9.UseMatchingInsteadOfFindAll (#7989)
  • RepositoryHandler.flatDir(Map) / mavenCentral(Map) → action form (9.6)

Simple removals / renames:

  • Dependencies.getProject()project() (no-arg) (9.4)
  • apply false in precompiled script plugins → remove (9.4)
  • .version(...) in precompiled settings script plugins → remove (9.4)
  • PMD targetJdk property → remove (9.6)
  • JavaForkOptions.setAllJvmArgs()setJvmArgs() / jvmArgs() (9.1)
  • Wrapper.getAvailableDistributionTypes()Wrapper.DistributionType.values() (9.3)
  • ReportingExtension.file(String)getBaseDirectory().file(...) (9.1)
  • CreateStartScripts.exitEnvironmentVar → remove (9.5)
  • Configuration.getTaskDependencyFromProjectDependency() → remove (9.6)
  • Kotlin DSL by registering / by extra → explicit register(...) (9.6, needs Kotlin DSL support)

Likely not worth a recipe (semantic / config-order / no clean target)

  • Implicit parent-project property lookup & Project.getProperties()providers.gradleProperty(...) (9.6) — needs data-flow analysis; changes laziness semantics
  • Task action accessing dependencies/extensions/injected services at execution time (9.6)
  • registerFeature before Java plugin applied / publishing unpublished projects (9.2/9.3)
  • buildNeeded / buildDependents / IDE file-generation tasks removal (9.6)
  • Develocity plugin pre-4.0 (version bump; covered by plugin-upgrade recipes)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Gradle 9.6 upgrade guide linked in the issue, then inspect org.openrewrite.gradle.MigrateToGradle9 and the unchecked recipe candidates. Choose one mechanical deprecation with a clear target, implement it within the Gradle 9 migration recipes, and verify that the selected deprecation is covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin
Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.