/jvm-dependency-conflict-resolution

Gradle plugin to improve Dependency Conflict Detection and Resolution

Primary LanguageJavaApache License 2.0Apache-2.0

JVM Dependency Conflict Detection and Resolution plugins

Build Status Gradle Plugin Portal

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.

What is a 'Capability' in Gradle and why should I care?

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.

How to use the plugin?

See the documentation.

Supported Gradle versions

  • 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.

Notes on the Plugins history

These plugins join, unify and extend functionalities that were previously part of the following discontinued plugins:

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")
}

Disclaimer

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.