Gradle picks wrong jars in multi-module project with diamond dependencies

I have to assume a number of things, based upon the classpath examples you posted. It will help if you maybe add the output of gradle dependencies --configuration runtime.

Also:

  • By default Gradle will always select the higher version of a dependency when more than one vesin is found. If this is not satisfactory then, resolutionStrategy or some simplification thereof can be utilised.
  • If the dependency is found in a linked project it will be preferred over the remoe version (unless you have configured it not to).
  • If the depedency is build in a sibliing project, but NOT linked to the current subproject via project(':NAME') it will use the remote dependency instead.
  • If you specifiy both a project dependency and a remote dependency I suspect the higher version of the artifact will still be used.