Gradle fails resolving when an Ivy module with explicit artifacts gets upgraded to a version that does not have the same artifacts


(Andreas Nyberg) #1

I have an Ivy repository with three modules:

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0"
            xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
    <info organisation="x" module="y" revision="1"/>
    <publications/>
</ivy-module>
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0"
            xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
    <info organisation="x" module="y" revision="2"/>
</ivy-module>
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0"
            xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
    <info organisation="x" module="yy" revision="42"/>
    <dependencies>
        <dependency org="x" name="y" rev="1">
            <artifact name="ugly" type="jar"/>
        </dependency>
    </dependencies>
</ivy-module>

‘x:y:1’ doesn’t declare an artifact, but it has one in the repository that ‘x:yy:42’ correctly requests. This is a common scenario: the dependent has to compensate for some omission of the publisher. In ‘x:y:2’ the publisher got it right, and the default artifact is in the expected location. However, during resolution, the old named artifacts stick and breaks resolution since they are not present in the new revision.

Old Ivy gets it right:

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0"
            xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
    <info organisation="a" module="b"/>
    <dependencies>
        <dependency org="x" name="yy" rev="42"/>
        <dependency org="x" name="y" rev="2"/>
    </dependencies>
</ivy-module>

Gradle 1.12 and 2.0-rc2 fail: Artifact ‘x:y:2:ugly.jar’ not found:

dependencies {
    compile 'x:yy:42'
    compile 'x:y:2'
}

(Andreas Nyberg) #2

This looks similar to GRADLE-2329 that was reported TWO YEARS AGO.