Add managed Maven dependency

Apache 2.0

Add a managed Maven dependency to a pom.xml file.

org.openrewrite.maven.AddManagedDependency

Required

The first part of a dependency coordinate 'org.apache.logging.log4j:ARTIFACT_ID:VERSION'.

The second part of a dependency coordinate 'org.apache.logging.log4j:log4j-bom:VERSION'.

An exact version number or node-style semver selector used to select the version number.

Optional

An optional scope to use for the dependency management tag.

An optional type to use for the dependency management tag.

An optional classifier to use for the dependency management tag

Allows version selection to be extended beyond the original Node Semver semantics. So for example,Setting 'version' to "25-29" can be paired with a metadata pattern of "-jre" to select 29.0-jre

releasesOnlyBoolean

Whether to exclude snapshots from consideration when using a semver selector

Only add managed dependencies to projects having a dependency matching the expression.

addToRootPomBoolean

Add to the root pom where root is the eldest parent of the pom within the source set.

The reason for adding the managed dependency. This will be added as an XML comment preceding the managed dependency.

mod run . --recipe=org.openrewrite.maven.AddManagedDependency \ -P groupId=org.apache.logging.log4j \ -P artifactId=log4j-bom \ -P version=latest.release

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.