jvm-dependency-conflict-resolution icon indicating copy to clipboard operation
jvm-dependency-conflict-resolution copied to clipboard

Clarify on preferred way to configure conflict resolutions

Open sschuberth opened this issue 1 year ago • 2 comments

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?

sschuberth avatar Aug 27 '24 11:08 sschuberth

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:

  • If for some reason you only use the detection plugin, use the first method (the other is not available)
  • If you take the full package with the resolution plugin, use the second method

jjohannes avatar Sep 02 '24 11:09 jjohannes

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

sschuberth avatar Sep 02 '24 11:09 sschuberth