gradlex-org / jvm-dependency-conflict-resolution

Gradle plugin to improve Dependency Conflict Detection and Resolution
http://gradlex.org/jvm-dependency-conflict-resolution/
Apache License 2.0
52 stars 14 forks source link

Clarify on preferred way to configure conflict resolutions #158

Open sschuberth opened 3 months ago

sschuberth commented 3 months ago

The docs both mention

configurations.all {
  resolutionStrategy.capabilitiesResolution {
    withCapability("javax.mail:mail") {        // Capability for which to make the decision
      select("com.sun.mail:jakarta.mail:0")    // The component to select
    }
  }
}

and

jvmDependencyConflicts {
    conflictResolution {
        // Customize resolution of capability conflicts
        select(JAVAX_ACTIVATION_API, "com.sun.activation:jakarta.activation")
    }
}

syntax. Are they semantically equivalent? Is one syntax preferable over the other?

jjohannes commented 2 months ago

I think we can improve the documentation there. Thanks for making us aware.


The first approach is Gradle core API. If you only use the detection plugin (for whatever reason), you can use that.

The second is the notation added by the resolution plugin that allows for a more compact notation with some tweaks. It's almost equivalent, but the notation also tells the resolution plugin not to register any standard strategy (which it does for most cases) so that you do not run into "weird" Gradle behavior like this one.

Bottom line:

sschuberth commented 2 months ago

Thanks for the clarification. It'd indeed be good if that explanation was in the docs as well!