Skip to content

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

Description

@timtebeek

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:

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions