← All recipes
Open source

Change Maven dependency exclusion

Recipe IDorg.openrewrite.maven.ChangeExclusion
Artifactorg.openrewrite:rewrite-maven

Modify Maven dependency exclusions, changing the group ID, artifact Id, or both. Useful when an excluded dependency has been renamed and references to it must be updated.

Single recipeApache 2.0

Usage

You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.maven.ChangeExclusion --recipe-option "oldGroupId=org.springframework" --recipe-option "oldArtifactId=spring-web*"

If the recipe isn’t available locally, install it with:

mod config recipes jar install org.openrewrite:rewrite-maven:8.88.0

Options

NameTypeDescription
oldGroupIdrequiredStringThe old groupId to replace. Supports glob expressions.
e.g. org.springframework
oldArtifactIdrequiredStringThe old artifactId to replace. Supports glob expressions.
e.g. spring-web*
newGroupIdStringThe new groupId to use. Defaults to the existing group id.
e.g. org.springframework.boot
newArtifactIdStringThe new artifactId to use. Defaults to the existing artifact id.
e.g. spring-boot-starter-web

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