Upgrade transitive Maven dependencies

Apache 2.0

Upgrades the version of a transitive dependency in a Maven pom file. Leaves direct dependencies unmodified. When the transitive dependency's version is already governed by a plain <dependencyManagement> entry in the project, that entry is upgraded in place rather than adding a duplicate; otherwise (including a version supplied by an imported BOM) a new managed dependency is added. Can be paired with the regular Upgrade Dependency Version recipe to upgrade a dependency everywhere, regardless of whether it is direct or transitive.

org.openrewrite.maven.UpgradeTransitiveDependencyVersion

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 upgrading the transitive dependency. This will be added as an XML comment preceding the managed dependency.

mod run . --recipe=org.openrewrite.maven.UpgradeTransitiveDependencyVersion \ -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.