Gradle 3.x behavior change wrt classifier artifact resolution in ivy modules

When we bump Gradle from 2 to 3 in our play-on-gradle projects the builds fail at dependency resolution. It looks like Gradle tries to download additional artifacts, some xml files. Those xml files do not exist in our artifactory.

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':play-skeleton-mt:play'.
> Could not find play-mt-pseudo.xml (com.linkedin.play-mt:play-mt:4.0.1).
  Searched in the following locations:
      http://dev-artifactory.corp.linkedin.com:8081/artifactory/release/com/linkedin/play-mt/play-mt/4.0.1/play-mt-pseudo-4.0.1.xml
> Could not find restli-server-plugin-cmpt-def.xml (com.linkedin.play-mt:restli-server-plugin:4.0.1).
  Searched in the following locations:
      http://dev-artifactory.corp.linkedin.com:8081/artifactory/release/com/linkedin/play-mt/restli-server-plugin/4.0.1/restli-server-plugin-cmpt-def-4.0.1.xml
> Could not find monitoring-plugin-cmpt-def.xml (com.linkedin.play-plugins:monitoring-plugin:5.0.47).
  Searched in the following locations:
      http://dev-artifactory.corp.linkedin.com:8081/artifactory/release/com/linkedin/play-plugins/monitoring-plugin/5.0.47/monitoring-plugin-cmpt-def-5.0.47.xml

We will do more digging on our end and try to figure out what modules are pulling in the xml files. If you have any feedback suggestions, let us know. For example, why is there a difference between how Gradle 2 and 3 resolve dependencies in this scenario?

What versions of Gradle are you upgrading to/from?

2.14.1 → 3.0

What version of Play! are you using?

I isolated the problem it is not related to play. The way Gradle resolves ivy artifacts has changed between 2.14.1 and 3.0. Consider following ivy module in our internal artifactory:

(directory in artifactory)

Then I declare dependency on com.linkedin.play-plugins:urls-plugin-6.0.22. What happens when I resolve the Gradle configuration with this dependency:

  1. Gradle 2.14.1 - 2 artifacts are downloaded: jar and xml
  2. Gradle 3.0 - Gradle throw exception:
   > Could not find urls-plugin-cmpt-def.xml (com.linkedin.play-plugins:urls-plugin:6.0.22).
     Searched in the following locations:
         http://dev-artifactory.corp.linkedin.com:8081/artifactory/release/com/linkedin/play-plugins/urls-plugin/6.0.22/urls-plugin-cmpt-def-6.0.22.xml

Note that Gradle 2.14.1 looks for “urls-plugin-cmpt-def-6.0.22-cmpt-def.xml” but Gradle 3.0 looks for “urls-plugin-cmpt-def-6.0.22.xml”. Given the content of the ivy file and the artifact name, Gradle 2.14.1 behavior seems correct.

Can you suggest us an approach to go past this problem? We are very keen on using Gradle 3.3 otherwise IDEA integration does not work for our Play on Gradle products. Thanks in advance for the help!

It looks like you’re hitting the fact that we now require the classifier attribute to be correctly declared in the http://ant.apache.org/ivy/maven namespace. See this GH issue and particularly this comment for more discussion on this.

Please try changing urls-plugin-6.0.22.ivy to look like this:

<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
    ... snip ...
    <publications>
        <artifact name="urls-plugin-cmpt-def" type="cmpt-def" ext="xml" conf="cmpt-def" 
                      m:classifier="cmpt-def"/>

Note the different namespace for the classifier attribute.

If this addresses your issue we can consider whether we should update Gradle to honour a “classifier” defined in the “extra attributes” namespace.

Thanks Daz for investigating the issue!

We have many artifacts published this way, mostly from the play / sbt builds. I will dig into how we can use your findings to resolve our issue. Given that we cannot easy change already published artifacts, do you have any other recommendations and suggestions?

There’s no real workaround, but I’ve pushed a fix that should make it into the next major release.

I verified the fix works at LinkedIn, tested with 3 projects using nightly Gradle from 2/14. THANKS A BUNCH!