Exclude a Gradle or Maven dependency

Apache 2.0

Exclude the specified dependency from any direct dependency that transitively includes it. For a Gradle project, adds an exclude to the declaration's closure in build.gradle or build.gradle.kts. For a Maven project, adds an <exclusion> to the dependency in the pom.xml.

org.openrewrite.java.dependencies.ExcludeDependency

Required

The first part of a dependency coordinate com.google.guava:guava:VERSION. Use * to exclude the artifact from every group. Partial wildcards are not supported.

The second part of a dependency coordinate com.google.guava:guava:VERSION. Use * to exclude every artifact in the group. Partial wildcards are not supported.

Optional

For Gradle only, only direct dependency declarations in this configuration are considered. If omitted, declarations in every configuration are considered.

For Maven only, only dependencies in this scope are considered. If you specify compile, this will NOT match dependencies in runtime.

mod run . --recipe=org.openrewrite.java.dependencies.ExcludeDependency \ -P groupId=commons-logging \ -P artifactId=commons-logging

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