Upgrade Gradle or Maven dependency versions
Apache 2.0For Gradle projects, upgrade the version of a dependency in a build.gradle or build.gradle.kts file. Supports updating dependency declarations of various forms:
Stringnotation:"group:artifact:version"Mapnotation:group: 'group', name: 'artifact', version: 'version'It is possible to update version numbers which are defined earlier in the same file in variable declarations, ingradle.properties, or in a version catalog.
For Maven projects, upgrade the version of a dependency by specifying a group ID and an artifact ID using Node Semver advanced range selectors, allowing more precise control over version updates to patch or minor releases.
org. openrewrite. java. dependencies. UpgradeDependencyVersionRequired
The first part of a dependency coordinate com.google.guava:guava:VERSION. This can be a glob expression.
The second part of a dependency coordinate com.google.guava:guava:VERSION. This can be a glob expression.
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 release version, latest.integration to include pre-release and snapshot versions, and latest.patch for patch updates if the current version is a valid semantic version. For more details, you can look at the documentation page of version selectors.
Optional
Allows version selection to be extended beyond the original Node Semver semantics. So for example, setting newVersion to "25-29" can be paired with a metadata pattern of "-jre" to select Guava 29.0-jre.
For Maven only, this flag can be set to explicitly override a managed dependency's version. The default for this flag is false.
For Maven only, accepts a list of GAVs. For each GAV, if it is a project direct dependency, and it is removed from dependency management after the changes from this recipe, then it will be retained with an explicit version. The version can be omitted from the GAV to use the old value from dependency management. Separate values with commas.
mod run . --recipe= org. openrewrite. java. dependencies. UpgradeDependencyVersion \
-P groupId= 'com. fasterxml. jackson*' \
-P artifactId= 'jackson-module*' \
-P newVersion=29. xInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.