Remove direct dependencies that are managed by a BOM with incompatible versions

Apache 2.0

Removes directly declared dependencies when they have a version that is incompatible with the version managed by an imported BOM (platform or enforcedPlatform). This is useful during framework upgrades (e.g., Spring Boot) where transitive dependencies receive major version bumps and explicitly declared older versions should be removed to use the BOM-managed versions instead. A dependency is only removed when it would still be reachable transitively through another direct dependency in every configuration where it is declared, so the BOM-managed version takes its place rather than the dependency disappearing from the classpath.

org.openrewrite.gradle.RemoveBomManagedDirectDependencies

Required

Group ID glob pattern for BOMs to consider. For example, org.springframework.boot to match Spring Boot BOMs.

Optional

Artifact ID glob pattern for BOMs to consider. For example, *-dependencies to match Spring Boot's BOM.

Group ID glob pattern for dependencies to check against BOM. Use * to match all dependencies.

Artifact ID glob pattern for dependencies to check against BOM. Use * to match all dependencies.

mod run . --recipe=org.openrewrite.gradle.RemoveBomManagedDirectDependencies \ -P bomGroupPattern=org.springframework.boot

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