This recipe will apply changes commonly needed when migrating to Java 21. This recipe will also replace deprecated API with equivalents when there is a clear migration strategy. Build files will also be updated to use Java 21 as the target/source and plugins will be also be upgraded to versions that are compatible with Java 21.
This recipe is composed of more than one recipe. If you want to customize the set of recipes this is composed of, you can find and copy the GitHub source for the recipe from the link above.
Usage
This recipe has no required configuration options. It can be activated by adding a dependency on org.openrewrite.recipe:rewrite-migrate-java:2.12.0 in your build file or by running a shell command (in which case no build changes are needed):
---type:specs.openrewrite.org/v1beta/recipename:org.openrewrite.java.migrate.UpgradeToJava21displayName:Migrate to Java 21description: This recipe will apply changes commonly needed when migrating to Java 21. This recipe will also replace deprecated API with equivalents when there is a clear migration strategy. Build files will also be updated to use Java 21 as the target/source and plugins will be also be upgraded to versions that are compatible with Java 21.
tags: - java21recipeList: - org.openrewrite.java.migrate.UpgradeToJava17 - org.openrewrite.java.migrate.JavaVersion21 - org.openrewrite.java.migrate.RemoveIllegalSemicolons - org.openrewrite.java.migrate.lang.ThreadStopUnsupported - org.openrewrite.java.migrate.net.URLConstructorsToURIRecipes - org.openrewrite.java.migrate.util.SequencedCollection - org.openrewrite.java.migrate.util.UseLocaleOf - org.openrewrite.staticanalysis.ReplaceDeprecatedRuntimeExecMethods - org.openrewrite.github.SetupJavaUpgradeJavaVersion: - org.openrewrite.gradle.UpdateGradleWrapper:version:8.5addIfMissing:false - org.openrewrite.maven.UpgradePluginVersion:groupId:org.jacocoartifactId:jacoco-maven-pluginnewVersion:0.8.+ - org.openrewrite.maven.UpgradePluginVersion:groupId:com.sonatype.clmartifactId:clm-maven-pluginnewVersion:2.47.8-01 - org.openrewrite.java.dependencies.UpgradeDependencyVersion:groupId:com.google.guavaartifactId:guavanewVersion:29.0versionPattern:-jre - org.openrewrite.java.dependencies.UpgradeDependencyVersion:groupId:net.bytebuddyartifactId:byte-buddynewVersion:1.14.11 - org.openrewrite.java.dependencies.UpgradeDependencyVersion:groupId:org.modelmapperartifactId:modelmappernewVersion:3.2.x
See how this recipe works across multiple open-source repositories
The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories.
Please contact Moderne for more information about safely running the recipes on your own codebase in a private SaaS.