The org.gradlex.jvm-dependency-conflict-detection
plugin adds Capabilities
to the metadata of well-known components hosted on Maven Central that are used in many Java projects.
The org.gradlex.jvm-dependency-conflict-resolution
plugin offers a compact language to address dependency conflicts by expressing strategies for Gradle to follow or to fix issues in the metadata of published components.
The videos below explain the concept of Capability Conflicts and why they can help you to avoid "dependency hell" in your project. With this plugin, you enable Gradle to detect and automatically resolved typical capability conflicts in the JVM ecosystem.
See the documentation.
- Minimal Gradle version is
6.8.3
Note: There are rules in this plugin (in particular for Guava) which work better with Gradle 7+
.
This is because Gradle 7 added support for the org.gradle.jvm.environment
attribute that allows Gradle to better distinguish between standard-jvm and android projects.
These plugins join, unify and extend functionalities that were previously part of the following discontinued plugins:
- https://plugins.gradle.org/plugin/org.gradlex.java-ecosystem-capabilities
- https://plugins.gradle.org/plugin/dev.jacomet.logging-capabilities
- https://plugins.gradle.org/plugin/de.jjohannes.java-ecosystem-capabilities
- https://plugins.gradle.org/plugin/de.jjohannes.missing-metadata-guava
NOTE on Guava:
Some of these plugins are used to patch older versions of Guava.
This functionality is discontinued.
Most of the patching is not included anymore by default, because Guava now publishes richer metadata and some of the adjustments were opinionated.
If you use the latest Guava version, you may not need anything specific.
If some of the transitive dependencies are not wanted in your case, you can fine tune them using the jvmDependencyConflicts.patch
DSL. E.g.:
jvmDependencyConflicts {
patch {
module("com.google.guava:guava") {
removeDependency("com.google.code.findbugs:jsr305")
reduceToCompileOnlyApiDependency("com.google.errorprone:error_prone_annotations")
}
}
}
If you need the previous behavior for older Guava versions, you can explicitly apply the GuavaComponentRule
.
dependencies.components {
withModule<GuavaComponentRule>("com.google.guava:guava")
}
Gradle and the Gradle logo are trademarks of Gradle, Inc. The GradleX project is not endorsed by, affiliated with, or associated with Gradle or Gradle, Inc. in any way.