Ivy converts pom.xml-Package-Tag into ivy.xml-Extension

Viewed 111

Problem

When using Jenkins Shared Libraries I try to @Grab('com.atlassian.jira:jira-rest-java-client-core:4.0.0'). This miserably fails while ivy tries to fetch dependencies:

General error during conversion: Error grabbing Grapes -- [download failed: com.atlassian.sal#sal-api;3.0.3!sal-api.atlassian-plugin, download failed: com.atlassian.httpclient#atlassian-httpclient-plugin;0.23.0!atlassian-httpclient-plugin.atlassian-plugin]

As far as I understand, this happens by the following reason: Ivy downloads the pom.xml files for the dependencies, converts them into ivy files and downloads the corresponding artifacts. These dependencies state a <packaging>atlassian-plugin</packaging> in their pom.xml, which is converted into <artifact name="atlassian-httpclient-plugin" type="atlassian-plugin" ext="atlassian-plugin" conf="master"/>. Ivy tries to download *.atlassian-plugin files now instead of *.jar.

Is this a bug in ivy, that should be reported? Or is atlassian missusing the packageing-Tag?

Minimal example for reproduction

I can reproduce the problem independently from jenkins using ant/ivy locally with the following files.

[ivy:retrieve] :: problems summary ::
[ivy:retrieve] :::: WARNINGS
[ivy:retrieve]          [NOT FOUND  ] com.atlassian.sal#sal-api;3.0.3!sal-api.atlassian-plugin (1041ms)
[ivy:retrieve]  ==== atlassian: tried
[ivy:retrieve]    https://packages.atlassian.com/mvn/maven-external/com/atlassian/sal/sal-api/3.0.3/sal-api-3.0.3.atlassian-plugin
[ivy:retrieve]          [NOT FOUND  ] com.atlassian.httpclient#atlassian-httpclient-plugin;0.23.0!atlassian-httpclient-plugin.atlassian-plugin (147ms)
[ivy:retrieve]  ==== atlassian: tried
[ivy:retrieve]    https://packages.atlassian.com/mvn/maven-external/com/atlassian/httpclient/atlassian-httpclient-plugin/0.23.0/atlassian-httpclient-plugin-0.23.0.atlassian-plugin
[ivy:retrieve]          ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]          ::              FAILED DOWNLOADS            ::
[ivy:retrieve]          :: ^ see resolution messages for details  ^ ::
[ivy:retrieve]          ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]          :: com.atlassian.sal#sal-api;3.0.3!sal-api.atlassian-plugin
[ivy:retrieve]          :: com.atlassian.httpclient#atlassian-httpclient-plugin;0.23.0!atlassian-httpclient-plugin.atlassian-plugin
[ivy:retrieve]          ::::::::::::::::::::::::::::::::::::::::::::::

build.xml

<project xmlns:ivy="antlib:org.apache.ivy.ant" name="hello-ivy" default="ivy-get-binaries">
  <target name="ivy-get-binaries">
   <ivy:settings file="ivysettings.xml" />
   <echoproperties prefix="ivy."/>
   <ivy:retrieve />
</target>
</project>

ivy.xml

<ivy-module version="2.0">
    <info organisation="foo" module="bar"/>
    <dependencies>
        <dependency org="com.atlassian.jira" name="jira-rest-java-client-core" rev="4.0.0"/>
    </dependencies>
</ivy-module>

ivysettings.xml

<ivysettings>
<settings defaultResolver="atlassian"/>
  <resolvers>
    <ibiblio name="atlassian" m2compatible="true" root="https://packages.atlassian.com/mvn/maven-external" />
  </resolvers>
</ivysettings>

Checking with Maven

Resolving the dependencies for jira-rest-java-client-core works fine using Maven:

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>foo</groupId>
    <artifactId>bar</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>

    <name>minimal-pom</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-rest-java-client-core</artifactId>
            <version>4.0.0</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    
    <repositories>
        <repository>
          <id>atlassian</id>
          <layout>default</layout>
          <url>https://packages.atlassian.com/mvn/maven-external</url>
        </repository>
      </repositories>

</project>
0 Answers
Related