Files
gh-openrewrite-rewrite-docs…/skills/writing-openrewrite-recipes/references/recipes-dependencies-common.csv
2025-11-30 08:45:33 +08:00

16 KiB

1Fully Qualified Recipe NameRecipe NameDescription
2org.openrewrite.java.dependencies.ChangeDependencyChange Gradle or Maven dependencyChange the group ID artifact ID and/or the version of a specified Gradle or Maven dependency.
3org.openrewrite.java.dependencies.DependencyInsightDependency insight for Gradle and MavenFinds dependencies including transitive dependencies in both Gradle and Maven projects. Matches within all Gradle dependency configurations and Maven scopes.
4org.openrewrite.java.dependencies.DependencyListDependency reportEmits a data table detailing all Gradle and Maven dependencies. This recipe makes no changes to any source file.
5org.openrewrite.java.dependencies.FindDependencyFind Maven and Gradle dependenciesFinds direct dependencies declared in Maven and Gradle build files. This does *not* search transitive dependencies. To detect both direct and transitive dependencies use `org.openrewrite.java.dependencies.DependencyInsight` This recipe works for both Maven and Gradle projects.
6org.openrewrite.java.dependencies.search.DoesNotIncludeDependencyDoes not include dependency for Gradle and MavenA precondition which returns false if visiting a Gradle file / Maven pom which includes the specified dependency in the classpath of some Gradle configuration / Maven scope. For compatibility with multimodule projects this should most often be applied as a precondition.
7org.openrewrite.java.dependencies.AddDependencyAdd Gradle or Maven dependencyFor a Gradle project add a gradle dependency to a `build.gradle` file in the correct configuration based on where it is used. Or For a maven project Add a Maven dependency to a `pom.xml` file in the correct scope based on where it is used.
8org.openrewrite.java.dependencies.DependencyResolutionDiagnosticDependency resolution diagnosticRecipes which manipulate dependencies must be able to successfully access the artifact repositories and resolve dependencies from them. This recipe produces two data tables used to understand the state of dependency resolution. The Repository accessibility report lists all the artifact repositories known to the project and whether respond to network access. The network access is attempted while the recipe is run and so is representative of current conditions. The Gradle dependency configuration errors lists all the dependency configurations that failed to resolve one or more dependencies when the project was parsed. This is representative of conditions at the time the LST was parsed.
9org.openrewrite.java.dependencies.RelocatedDependencyCheckFind relocated dependenciesFind Maven and Gradle dependencies and Maven plugins that have relocated to a new `groupId` or `artifactId`. Relocation information comes from the [oga-maven-plugin](https://github.com/jonathanlermitage/oga-maven-plugin/) maintained by Jonathan Lermitage Filipe Roque and others. This recipe makes no changes to any source file by default. Add `changeDependencies=true` to change dependencies but note that you might need to run additional recipes to update imports and adopt other breaking changes.
10org.openrewrite.java.dependencies.RemoveDependencyRemove a Gradle or Maven dependencyFor Gradle project removes a single dependency from the dependencies section of the `build.gradle`. For Maven project removes a single dependency from the `<dependencies>` section of the pom.xml.
11org.openrewrite.java.dependencies.UpgradeDependencyVersionUpgrade Gradle or Maven dependency versionsFor Gradle projects upgrade the version of a dependency in a `build.gradle` file. Supports updating dependency declarations of various forms: * `String` notation: `"group:artifact:version"` * `Map` notation: `group: 'group' name: 'artifact' version: 'version'` It is possible to update version numbers which are defined earlier in the same file in variable declarations. For Maven projects upgrade the version of a dependency by specifying a group ID and (optionally) an artifact ID using Node Semver advanced range selectors allowing more precise control over version updates to patch or minor releases.
12org.openrewrite.java.dependencies.UpgradeTransitiveDependencyVersionUpgrade transitive Gradle or Maven dependenciesUpgrades the version of a transitive dependency in a Maven pom.xml or Gradle build.gradle. Leaves direct dependencies unmodified. Can be paired with the regular Upgrade Dependency Version recipe to upgrade a dependency everywhere regardless of whether it is direct or transitive.
13org.openrewrite.java.dependencies.search.FindMinimumDependencyVersionFind the oldest matching dependency version in useThe oldest dependency version in use is the lowest dependency version in use in any source set of any subproject of a repository. It is possible that for example the main source set of a project uses Jackson 2.11 but a test source set uses Jackson 2.16. In this case the oldest Jackson version in use is Java 2.11.
14org.openrewrite.java.dependencies.search.ModuleHasDependencyModule has dependencySearches for both Gradle and Maven modules that have a dependency matching the specified groupId and artifactId. Places a `SearchResult` marker on all sources within a module with a matching dependency. This recipe is intended to be used as a precondition for other recipes. For example this could be used to limit the application of a spring boot migration to only projects that use spring-boot-starter limiting unnecessary upgrading. If the search result you want is instead just the build.gradle(.kts) or pom.xml file applying the plugin use the `FindDependency` recipe instead.
15org.openrewrite.java.dependencies.search.RepositoryHasDependencyRepository has dependencySearches for both Gradle and Maven modules that have a dependency matching the specified groupId and artifactId. Places a `SearchResult` marker on all sources within a repository with a matching dependency. This recipe is intended to be used as a precondition for other recipes. For example this could be used to limit the application of a spring boot migration to only projects that use a springframework dependency limiting unnecessary upgrading. If the search result you want is instead just the build.gradle(.kts) or pom.xml file applying the plugin use the `FindDependency` recipe instead.
16org.openrewrite.java.dependencies.DependencyLicenseCheckFind licenses in use in third-party dependenciesLocates and reports on all licenses in use.
17org.openrewrite.java.dependencies.DependencyVulnerabilityCheckFind and fix vulnerable dependenciesThis software composition analysis (SCA) tool detects and upgrades dependencies with publicly disclosed vulnerabilities. This recipe both generates a report of vulnerable dependencies and upgrades to newer versions with fixes. This recipe by default only upgrades to the latest **patch** version. If a minor or major upgrade is required to reach the fixed version this can be controlled using the `maximumUpgradeDelta` option. Vulnerability information comes from the [GitHub Security Advisory Database](https://docs.github.com/en/code-security/security-advisories/global-security-advisories/about-the-github-advisory-database) which aggregates vulnerability data from several public databases including the [National Vulnerability Database](https://nvd.nist.gov/) maintained by the United States government. Upgrades dependencies versioned according to [Semantic Versioning](https://semver.org/). Last updated: 2025-10-20T1103.
18org.openrewrite.java.dependencies.RemoveUnusedDependenciesRemove unused dependenciesScans through source code collecting references to types and methods removing any dependencies that are not used from Maven or Gradle build files. This recipe takes reflective access into account: When reflective access to a class is made unambiguously via a string literal such as: `Class.forName("java.util.List")` that is counted correctly. When reflective access to a class is made ambiguously via anything other than a string literal no dependencies will be removed. This recipe takes transitive dependencies into account: When a direct dependency is not used but a transitive dependency it brings in _is_ in use the direct dependency is not removed.
19org.openrewrite.java.dependencies.SoftwareBillOfMaterialsSoftware bill of materialsProduces a software bill of materials (SBOM) for a project. An SBOM is a complete list of all dependencies used in a project including transitive dependencies. The produced SBOM is in the [CycloneDX](https://cyclonedx.org/) XML format. Supports Gradle and Maven. Places a file named sbom.xml adjacent to the Gradle or Maven build file.
20org.openrewrite.maven.AddAnnotationProcessorAdd an annotation processor to `maven-compiler-plugin`Add an annotation processor to the maven compiler plugin. Will not do anything if it already exists. Also doesn't add anything when no other annotation processors are defined yet. (Perhaps `ChangePluginConfiguration` can be used).
21org.openrewrite.maven.AddParentPomAdd Maven parentAdd a parent pom to a Maven pom.xml. Does nothing if a parent pom is already present.
22org.openrewrite.maven.AddPluginAdd Maven pluginAdd the specified Maven plugin to the pom.xml.
23org.openrewrite.maven.AddPluginDependencyAdd Maven plugin dependenciesAdds the specified dependencies to a Maven plugin. Will not add the plugin if it does not already exist in the pom.
24org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactIdChange Maven managed dependency groupId artifactId and optionally the versionChange the groupId artifactId and optionally the version of a specified Maven managed dependency.
25org.openrewrite.maven.ChangeParentPomChange Maven parentChange the parent pom of a Maven pom.xml by matching the existing parent via groupId and artifactId and updating it to a new groupId artifactId version and optional relativePath. Also updates the project to retain dependency management and properties previously inherited from the old parent that are no longer provided by the new parent. Removes redundant dependency versions already managed by the new parent.
26org.openrewrite.maven.ChangePluginConfigurationChange Maven plugin configurationApply the specified configuration to a Maven plugin. Will not add the plugin if it does not already exist in the pom.
27org.openrewrite.maven.ChangePluginDependenciesChange Maven plugin dependenciesApplies the specified dependencies to a Maven plugin. Will not add the plugin if it does not already exist in the pom.
28org.openrewrite.maven.ChangePluginExecutionsChange Maven plugin executionsApply the specified executions to a Maven plugin. Will not add the plugin if it does not already exist in the pom.
29org.openrewrite.maven.ChangePluginGroupIdAndArtifactIdChange Maven plugin group and artifact IDChange the groupId and/or the artifactId of a specified Maven plugin. Optionally update the plugin version. This recipe does not perform any validation and assumes all values passed are valid.
30org.openrewrite.maven.ManagedToRuntimeDependenciesConvert managed dependencies to runtime dependenciesThis recipe processes Maven POMs converting all `<dependencyManagement>` entries into runtime scoped `<dependencies>` entries. Import scoped BOMs (like jackson-bom) are left unmodified in `<dependencyManagement>`. Some style guidelines prefer that `<dependencyManagement>` be used only for BOMs. This maintain that style while avoiding introducing new symbols onto the compile classpath unintentionally.
31org.openrewrite.maven.RemoveDuplicatePluginDeclarationsRemove duplicate plugin declarationsMaven 4 rejects duplicate plugin declarations (same groupId and artifactId) with an error. This recipe removes duplicate plugin declarations keeping only the first occurrence.
32org.openrewrite.maven.RemoveManagedDependencyRemove Maven managed dependencyRemoves a single managed dependency from the <dependencyManagement><dependencies> section of the pom.xml.
33org.openrewrite.maven.RemovePluginRemove Maven pluginRemove the specified Maven plugin from the POM.
34org.openrewrite.maven.RemovePluginDependencyRemove Maven plugin dependencyRemoves a dependency from the <dependencies> section of a plugin in the pom.xml.
35org.openrewrite.maven.RemoveRedundantDependencyVersionsRemove redundant explicit dependency and plugin versionsRemove explicitly-specified dependency/plugin versions when a parent POM's `dependencyManagement`/`pluginManagement` specifies the version.
36org.openrewrite.maven.UpgradeParentVersionUpgrade Maven parent project versionSet the parent pom version number according to a [version selector](https://docs.openrewrite.org/reference/dependency-version-selectors) or to a specific version number.
37org.openrewrite.gradle.plugins.AddBuildPluginAdd Gradle pluginAdd a build plugin to a Gradle build file's `plugins` block.
38org.openrewrite.gradle.plugins.AddDevelocityGradlePluginAdd the Develocity Gradle pluginAdd the Develocity Gradle plugin to settings.gradle files.
39org.openrewrite.gradle.plugins.AddSettingsPluginAdd Gradle settings pluginAdd plugin to Gradle settings file `plugins` block by id.
40org.openrewrite.gradle.plugins.ChangePluginChange a Gradle pluginChanges the selected Gradle plugin to the new plugin.
41org.openrewrite.gradle.plugins.ChangePluginVersionChange a Gradle plugin version by idChange a Gradle plugin by id to a later version.
42org.openrewrite.gradle.plugins.RemoveBuildPluginRemove Gradle pluginRemove plugin from Gradle `plugins` block by its id. Does not remove plugins from the `buildscript` block.
43org.openrewrite.gradle.plugins.RemoveSettingsPluginRemove Gradle settings pluginRemove plugin from Gradle settings file `plugins` block by id.
44org.openrewrite.gradle.search.FindGradleWrapperFind Gradle wrappersFind Gradle wrappers.
45org.openrewrite.gradle.search.FindJVMTestSuitesFind Gradle JVMTestSuite plugin configurationFind Gradle JVMTestSuite plugin configurations and produce a data table.
46org.openrewrite.gradle.search.FindPluginsFind Gradle pluginFind a Gradle plugin by id and/or class name. For best results both should be specified as one cannot automatically be used to infer the other.
47org.openrewrite.gradle.UpdateGradleWrapperUpdate Gradle wrapperUpdate the version of Gradle used in an existing Gradle wrapper. Queries services.gradle.org to determine the available releases but prefers the artifact repository URL which already exists within the wrapper properties file. If your artifact repository does not contain the same Gradle distributions as services.gradle.org then the recipe may suggest a version which is not available in your artifact repository.
48org.openrewrite.gradle.plugins.UpgradePluginVersionUpdate a Gradle plugin by idUpdate a Gradle plugin by id to a later version defined by the plugins DSL. To upgrade a plugin dependency defined by `buildscript.dependencies` use the `UpgradeDependencyVersion` recipe instead.
49org.openrewrite.gradle.search.ModuleHasPluginModule has pluginSearches for Gradle Projects (modules) that have a plugin matching the specified id or implementing class. Places a `SearchResult` marker on all sources within a project with a matching plugin. This recipe is intended to be used as a precondition for other recipes. For example this could be used to limit the application of a spring boot migration to only projects that apply the spring dependency management plugin limiting unnecessary upgrading. If the search result you want is instead just the build.gradle(.kts) file applying the plugin use the `FindPlugins` recipe instead.
50org.openrewrite.gradle.spring.AddSpringDependencyManagementPluginAdd `io.spring.dependency-management` plugin if in usePrior to Spring Boot 2.0 the dependency management plugin was applied automatically as part of the overall spring boot plugin. Afterwards the dependency-management plugin must be applied explicitly or Gradle's `platform()` feature may be used instead. This recipe makes usage of io-spring.dependency-management explicit in anticipation of upgrade to Spring Boot 2.0 or later.