Remove a Gradle or Maven dependency

Apache 2.0

For a Gradle project, removes a single dependency from the dependencies section of the build.gradle or build.gradle.kts. For a Maven project, removes a single dependency from the <dependencies> section of the pom.xml.

org.openrewrite.java.dependencies.RemoveDependency

Required

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.

Optional

Do not remove if type is in use. Supports glob expressions.

For Gradle only, the dependency configuration to remove from.

For Maven only, only remove dependencies if they are in this scope. If runtime, this will also remove dependencies in the compile scope because compile dependencies are part of the runtime dependency set.

mod run . --recipe=org.openrewrite.java.dependencies.RemoveDependency \ -P groupId='com.fasterxml.jackson*' \ -P artifactId='jackson-module*'

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