Package org.axonframework.migration
Class UpgradeJava
java.lang.Object
org.openrewrite.Recipe
org.axonframework.migration.UpgradeJava
- All Implemented Interfaces:
Cloneable
public class UpgradeJava
extends org.openrewrite.Recipe
Bumps the Java compiler target to a configurable LTS, with validation that the target satisfies
the Axon Framework 5 minimum (Java 21).
Wraps UpgradeJavaVersion to:
- expose a single, well-named entrypoint with a sensible default
(21, the Axon Framework 5 minimum). Projects already on a
later Java release (23, 24, 25, …) are left untouched —
UpgradeJavaVersiononly upgrades, never downgrades — so the default is conservative on purpose; - reject targets below 21 so misconfigurations fail loudly rather than producing a build that cannot compile against Axon 5.
This recipe only updates build files (pom.xml, build.gradle); it does not apply
any source-level Java modernizations. If you also want source rewrites such as text blocks,
pattern matching, sequenced collections or javax→jakarta translation, run the
upstream org.openrewrite.java.migrate.UpgradeToJava21 separately or compose it into your
own wrapping recipe.
The targetVersion option is overridable per invocation — see the module README.md
for instructions on raising the target above the default (e.g. Java 25).
- Since:
- 5.1.1
- Author:
- Mateusz Nowak
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openrewrite.Recipe
org.openrewrite.Recipe.Builder, org.openrewrite.Recipe.DelegatingRecipe -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault target Java version whentargetVersionis unset.static final intMinimum supported target.Fields inherited from class org.openrewrite.Recipe
contributors, examples, PANIC -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.openrewrite.Recipe
addDataTable, builder, buildRecipeList, causesAnotherCycle, clone, createRecipeDescriptor, equals, getContributors, getDataTableDescriptors, getDescriptor, getEstimatedEffortPerOccurrence, getExamples, getInstanceName, getInstanceNameSuffix, getJacksonPolymorphicTypeTag, getMaintainers, getName, getTags, getVisitor, hashCode, maxCycles, noop, onComplete, run, run, run, setContributors, setExamples, validate, validate, validateAll, validateAll, withOptions
-
Field Details
-
DEFAULT_TARGET_VERSION
public static final int DEFAULT_TARGET_VERSIONDefault target Java version whentargetVersionis unset. Equal to the Axon Framework 5 minimum (Java 21). Chosen so that projects already on a higher Java release are left untouched, sinceUpgradeJavaVersiononly upgrades and never downgrades.- See Also:
-
MINIMUM_TARGET_VERSION
public static final int MINIMUM_TARGET_VERSIONMinimum supported target. Axon Framework 5 requires Java 21+; lower targets are rejected at configuration time.- See Also:
-
-
Constructor Details
-
UpgradeJava
public UpgradeJava() -
UpgradeJava
-
-
Method Details
-
getTargetVersion
-
getDisplayName
- Specified by:
getDisplayNamein classorg.openrewrite.Recipe
-
getDescription
- Specified by:
getDescriptionin classorg.openrewrite.Recipe
-
getRecipeList
- Overrides:
getRecipeListin classorg.openrewrite.Recipe
-