Update Gradle project Java compatibility
Recipe ID
org.openrewrite.gradle.UpdateJavaCompatibilityArtifact
org.openrewrite:rewrite-gradleFind and updates the Java compatibility for the Gradle project.
Usage
You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.gradle.UpdateJavaCompatibility --recipe-option "version=11"If the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite:rewrite-gradle:8.88.0Options
| Name | Type | Description |
|---|---|---|
versionrequired | Integer | The Java version to upgrade to. e.g. 11 |
compatibilityType | CompatibilityType | The compatibility type to change |
declarationStyle | DeclarationStyle | The desired style to write the new version as when being written to the sourceCompatibility or targetCompatibility variables. Default, match current source style. (ex. Enum: JavaVersion.VERSION_11, Number: 11, or String: "11") |
allowDowngrade | Boolean | Allow downgrading the Java version. |
addIfMissing | Boolean | Adds the specified compatibility type if one is not found. |
Data tables
Structured output this recipe can produce.
- 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