openrewrite / openrewrite/rewrite
Gradle 9.x: recipes for new 9.1–9.6 deprecations
Nobody has claimed this yet.
- 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 -
JavaPluginConventionremoval (top-levelsourceCompatibility/targetCompatibility) →gradle9.UseJavaExtensionBlock -
mainClassName→mainClass→gradle9.UseMainClassProperty(ForApplication) -
version = { }→ closure form →gradle9.UseVersionClosure - spread
*configurations.all→gradle9.RewriteSpreadAllInConfigurationsBlock
New recipe candidates (mechanical, good fit)
High value:
- Current-project dependency: module coordinates →
project(":x")(9.3) — replacegroup:name:versionreferring to the current project withproject()notation —gradle9.UseProjectDependencyInsteadOfModuleCoordinates(#7989) -
Projectobject 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 falsein precompiled script plugins → remove (9.4) -
.version(...)in precompiled settings script plugins → remove (9.4) - PMD
targetJdkproperty → 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→ explicitregister(...)(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)
-
registerFeaturebefore 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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