Gradle not handling Maven parent POMs with version-range


(Michael Weir) #1

I have a Gradle build that needs to fetch dependencies from a Nexus
repo that has been populated using Maven. Some of the POMs there use
version-ranges when specifying a parent POM.

In my build.gradle I put a dependency:

compile group: 'com.company.platform', name: 'abc-common', version: '[11.0,12.0['

The Gradle logs show that a request is made for the versions of abc-common, and its POM and its parent’s POM are fetched:

abc-common-11.0.7-17042111.pom:
<parent>
    <groupId>com.company.platform</groupId>
    <artifactId>abc-parent</artifactId>
    <version>11.0.7-17042111</version>
    <relativePath>..</relativePath>
</parent>

abc-parent-11.0.7-17042111.pom:
<parent>
    <groupId>com.company.corporate</groupId>
    <artifactId>corporate-parent</artifactId>
    <version>[11.0.7,11.0.8)</version>
    <relativePath/>
</parent>

But Gradle fails to fetch the corporate-parent POM. Instead of
requesting what versions are present on the repo, it tries to fetch
using the version-range literal:

Loading http://nexus.company.com:8081/.../corporate-parent/[11.0.7,11.0.8)/corporate-parent-[11.0.7,11.0.8).pom

Am I doing something wrong? Is this a known problem with Gradle? Is there a work-around?

Any help is much appreciated. This is a show-stopper for me. If I can’t find a solution, I’ll have to convert our build back to Maven.