Migrate to Gradle 9 from Gradle 8
Recipe ID
org.openrewrite.gradle.MigrateToGradle9Artifact
org.openrewrite:rewrite-gradleMigrate to version 9.x. See the Gradle upgrade guide from version 8.x to 9.0 for more information.
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.gradle.MigrateToGradle9If the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite:rewrite-gradle:8.88.0Definition
This recipe runs the following recipes in order.
- Migrate to Gradle 8 from Gradle 7
org.openrewrite.gradle.MigrateToGradle8 - Update Gradle wrapper
org.openrewrite.gradle.UpdateGradleWrapper - Use
Stringnotation for Gradle dependency declarationsorg.openrewrite.gradle.DependencyUseStringNotation - Use one dependency declaration per statement
org.openrewrite.gradle.gradle9.OneDependencyDeclarationPerStatement - Use
mainClassinstead ofmainforJavaExectasksorg.openrewrite.gradle.gradle9.UseMainClassProperty - Use
application { mainClass }instead ofmainClassNameorg.openrewrite.gradle.gradle9.UseMainClassPropertyForApplication - Move
sourceCompatibilityandtargetCompatibilityinto thejava { }extension blockorg.openrewrite.gradle.gradle9.UseJavaExtensionBlock - Replace spread-
all*calls inconfigurationsblocks withconfigurations.all { }org.openrewrite.gradle.gradle9.RewriteSpreadAllInConfigurationsBlock - Use
version { }closure instead ofversion = { }assignmentorg.openrewrite.gradle.gradle9.UseVersionClosure - Use
project(...)dependency notation instead of the current project's module coordinatesorg.openrewrite.gradle.gradle9.UseProjectDependencyInsteadOfModuleCoordinates - Use
matching(Closure)instead offindAll(Closure)on Gradle container collectionsorg.openrewrite.gradle.gradle9.UseMatchingInsteadOfFindAll
Data tables
Structured output this recipe can produce.
- Maven metadata failuresAttempts to resolve maven metadata that failed.
org.openrewrite.maven.table.MavenMetadataFailures - Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats