Change Gradle dependency

Apache 2.0

Change a Gradle dependency coordinates. The newGroupId or newArtifactId MUST be different from before.

org.openrewrite.gradle.ChangeDependency

Required

The old groupId to replace. The groupId is the first part of a dependency coordinate 'com.google.guava:guava:VERSION'. Supports glob expressions.

The old artifactId to replace. The artifactId is the second part of a dependency coordinate 'com.google.guava:guava:VERSION'. Supports glob expressions.

Optional

The new groupId to use. Defaults to the existing group id.

The new artifactId to use. Defaults to the existing artifact id.

An exact version number or node-style semver selector used to select the version number. You can also use latest.release for the latest available version and latest.patch if the current version is a valid semantic version. For more details, you can look at the documentation page of version selectors.

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 Guava 29.0-jre

overrideManagedVersionBoolean

If the old dependency has a managed version, this flag can be used to explicitly set the version on the new dependency. WARNING: No check is done on the NEW dependency to verify if it is managed, it relies on whether the OLD dependency had a managed version. The default for this flag is false.

changeManagedDependencyBoolean

Also update the dependency management section. The default for this flag is true.

mod run . --recipe=org.openrewrite.gradle.ChangeDependency \ -P oldGroupId=org.openrewrite.recipe \ -P oldArtifactId=rewrite-testing-frameworks

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