Migrate to Maven 4
Recipe ID
org.openrewrite.maven.MigrateToMaven4Artifact
org.openrewrite:rewrite-mavenMigrates Maven POMs from Maven 3 to Maven 4, addressing breaking changes and deprecations. This recipe updates property expressions, lifecycle phases, removes duplicate plugin declarations, and replaces removed properties to ensure compatibility with Maven 4.
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.maven.MigrateToMaven4If the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite:rewrite-maven:8.88.0Definition
This recipe runs the following recipes in order.
- Drop prefixless expressions in POM
org.openrewrite.maven.cleanup.PrefixlessExpressions - Replace removed root directory properties
org.openrewrite.maven.ReplaceRemovedRootDirectoryProperties - Replace deprecated lifecycle phases
org.openrewrite.maven.ReplaceDeprecatedLifecyclePhases - Remove duplicate plugin declarations
org.openrewrite.maven.RemoveDuplicatePluginDeclarations - Upgrade to Maven model version 4.1.0
org.openrewrite.maven.UpgradeToModelVersion410 - Replace modules with subprojects
org.openrewrite.maven.ReplaceModulesWithSubprojects
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