Dependency resolution issue


(Alex Dubrouski) #1

Gradle Version: 3.1
Operating System and JVM version: Debian Wheezy, JSDK 1.8

I have few patched jars for legacy code. Ant build worked fine because it has all jars committed to SCM. During migration to Gradle I identified weird behavior. Initially patched jars were published to local Nexus with classifiers, but this fails if Maven Central is the first in repository list. I.e.:
compile 'commons-collections:commons-collections:3.2.2:patched'
Gradle finds 3.2.2 in Maven Central and stops checking other repos. There is a flag to continue searching, but it is very inconvenient to remember which project needs this flag when you have a lot of them.
Thus I decided to publish it to local Nexus with custom version i.e.:
compile 'commons-collections:commons-collections:3.2.2-patched'
and Gradle started to fail with really weird exception:

 > Could not find commons-collections-patched.jar (commons-collections:commons-collections:3.2.2-patched).
  Searched in the following locations:
      http://nexus-local/nexus/content/repositories/thirdparty/commons-collections/commons-collections/3.2.2-patched/commons-collections-3.2.2-patched-patched.jar

Take your attention to URL generated. It contains -patched-patched. I also tried to explicitly set classifier to empty string:
[group: 'commons-collections', name: "commons-collections", version: "3.2.2-patched", classifier: ""]
but it did not fix the problem.