How to use JIRA REST client library?

孤街浪徒 提交于 2020-05-15 09:06:31

问题


I need to use JIRA REST client version 5.2.0 or higher. Cloud JIRA does not work with an earlier version of the client.

In my pom.xml file I have the following dependencies:

<dependency>
    <groupId>com.atlassian.jira</groupId>
    <artifactId>jira-rest-java-client-core</artifactId>
    <version>5.2.1</version>
</dependency>
<dependency>
    <groupId>com.atlassian.jira</groupId>
    <artifactId>jira-rest-java-client-app</artifactId>
    <version>5.2.1</version>
</dependency>

When I building the project, I get an exception like this:

Failed to execute goal on project XXXXXXXXX: Could not resolve dependencies for project  XXXXXXXXXX:jar:XXXX: Failed to collect dependencies at com.atlassian.jira:jira-rest-java-client-core:jar:5.2.1: Failed to read artifact descriptor for com.atlassian.jira:jira-rest-java-client-core:jar:5.2.1: Could not find artifact com.atlassian.platform:platform:pom:3.1.7 in MY_REPO (http://XXXXXXXXXX/repository/maven-public) -

com.atlassian.platform:platform:pom:3.1.7 is not listd at mvnrepository. There are versions 3.1.12 and 3.1.17, but not 3.1.7. Someone told me that version 3.1.7 might have had a security-related bug and was therefore removed by Atlassian.

Both jira-rest-java-client-app and jira-rest-java-client-core are children of jira-rest-java-client-parent, which uses version 3.1.7 of the platform:

    <groupId>com.atlassian.jira</groupId>
    <artifactId>jira-rest-java-client-parent</artifactId>
    <version>5.2.1</version>
    <packaging>pom</packaging>

    [...]

    <properties>
        <platform.version>3.1.7</platform.version>

        [...]

    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.atlassian.platform</groupId>
                <artifactId>platform</artifactId>
                <version>${platform.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

5.2.1 seems to be the latest version of both jira-rest-java-client-core and jira-rest-java-client-app.

How can I use the JIRA REST client (for programmatically creating issues in Cloud JIRA) when it uses a version of the library that is not available any more?

I tried to exclude the platform in the dependencies and to specify another version in depencency management sections. This did not help.


回答1:


If you have a look at the repository

https://packages.atlassian.com/mvn/maven-external

from atlassian, you find the desired artifact com.atlassian.platform:platform:pom:3.1.7there. Since this repository seems to be from atlassian, I see no reason to believe that they recommend not to use the version.

This is also discussed in https://community.atlassian.com/t5/Jira-questions/Jira-rest-java-client-core-5-1-and-fugue-2-7-0-breaks-build/qaq-p/1151091



来源:https://stackoverflow.com/questions/60437653/how-to-use-jira-rest-client-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!