JRJC抛出NoClassDefFound异常

时间:2016-04-26 11:56:01

标签: java maven pom.xml jira-rest-api jira-rest-java-api

我正在尝试在我的项目中使用Jira Rest Java Client。但无法连接到我安装的jira。使用以下代码段时:

JiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();
 JiraRestClient restClient =factory.createWithBasicHttpAuthentication(serverURI, "praveen",
 "Jira@123");

我面临如下所述的错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/nio/NHttpMessageParserFactory
at org.apache.http.impl.nio.conn.PoolingClientAsyncConnectionManager.createClientAsyncConnectionFactory(PoolingClientAsyncConnectionManager.java:96)
at org.apache.http.impl.nio.conn.PoolingClientAsyncConnectionManager.<init>(PoolingClientAsyncConnectionManager.java:72)
at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClient$2.<init>(DefaultHttpClient.java:117)
at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClient.<init>(DefaultHttpClient.java:115)
at com.atlassian.jira.rest.client.internal.async.AsynchronousHttpClientFactory.createClient(AsynchronousHttpClientFactory.java:53)
at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.create(AsynchronousJiraRestClientFactory.java:35)
at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.createWithBasicHttpAuthentication(AsynchronousJiraRestClientFactory.java:42)
at com.praveen.jira.JiraPoc.main(JiraPoc.java:77)

我在我的pom.xml中使用JRJC作为以下标记的依赖:

<dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-rest-java-client-api</artifactId>
        <version>2.0.0-m25</version>
    </dependency>

我有什么遗失的东西。 我的客户端使用类与jira的示例位于同一行:

https://bitbucket.org/atlassian/jrjc-example/src/54673b037ab77997c22950ff00489de1752f0353/src/main/java/com/atlassian/jira/rest/client/example/Main.java?at=master&fileviewer=file-view-default

请帮助我,我被困了很长时间。如果可能请提供工作示例。 根据要求编辑:

C:\Users\praveen.joshi\git\dashboard\jira-poc>mvn dependency:tree -Dverbose
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.bolt.dashboard:jira-poc:jar:0.0.1-SNAPSHOT
[WARNING] 'parent.relativePath' of POM com.bolt.dashboard:jira-poc:0.0.1-SNAPSHOT (C:\Users\praveen.joshi\git\dashboard\jira-poc\pom.xml) points at com.bolt.dashboard:jenkins-collector instead of org.springframework.boot:spring-boot-starter-parent, please verify your project structure @ line 9, column 10
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution
[INFO] com.praveen.dashboard:jira-poc:jar:0.0.1-SNAPSHOT
[INFO] +- com.praveen.dashboard:core:jar:0.0.1-SNAPSHOT:compile
[INFO] |  +- org.springframework:spring-test:jar:4.2.5.RELEASE:compile (version managed from 4.1.7.RELEASE)
[INFO] |  |  \- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] |  +- org.springframework.data:spring-data-mongodb:jar:1.8.4.RELEASE:compile (version managed from 1.8.0.RELEASE)
[INFO] |  |  +- org.springframework:spring-tx:jar:4.2.5.RELEASE:compile (version managed from 4.1.9.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  |  \- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-context:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  +- org.springframework:spring-expression:jar:4.2.5.RELEASE:compile
[INFO] |  |  |  \- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  +- org.springframework.data:spring-data-commons:jar:1.11.4.RELEASE:compile
[INFO] |  |  |  +- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  |  +- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.7.13; omitted for duplicate)
[INFO] |  |  |  \- (org.slf4j:jcl-over-slf4j:jar:1.7.16:runtime - version managed from 1.7.13; omitted for duplicate)
[INFO] |  |  +- (org.mongodb:mongo-java-driver:jar:2.13.3:compile - version managed from 2.10.0; omitted for duplicate)
[INFO] |  |  +- org.slf4j:slf4j-api:jar:1.7.16:compile
[INFO] |  |  \- (org.slf4j:jcl-over-slf4j:jar:1.7.16:compile - version managed from 1.7.13; scope updated from runtime; omitted for duplicate)
[INFO] |  +- org.springframework:spring-core:jar:4.2.5.RELEASE:compile
[INFO] |  +- org.springframework:spring-context-support:jar:4.2.5.RELEASE:compile (version managed from 4.1.7.RELEASE)
[INFO] |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-context:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  \- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] |  +- org.quartz-scheduler:quartz:jar:2.2.1:compile
[INFO] |  |  +- c3p0:c3p0:jar:0.9.1.1:compile
[INFO] |  |  \- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.6.6; omitted for duplicate)
[INFO] |  +- com.mysema.querydsl:querydsl-jpa:jar:3.6.0:compile
[INFO] |  |  +- com.mysema.querydsl:querydsl-core:jar:3.6.0:compile
[INFO] |  |  |  +- (com.google.guava:guava:jar:18.0:compile - omitted for conflict with 10.0.1)
[INFO] |  |  |  +- (com.google.code.findbugs:jsr305:jar:1.3.9:compile - omitted for duplicate)
[INFO] |  |  |  +- com.mysema.commons:mysema-commons-lang:jar:0.2.4:compile
[INFO] |  |  |  \- com.infradna.tool:bridge-method-annotation:jar:1.13:compile
[INFO] |  |  \- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.6.1; omitted for duplicate)
[INFO] |  +- com.mysema.querydsl:querydsl-apt:jar:3.6.0:compile
[INFO] |  |  \- com.mysema.querydsl:querydsl-codegen:jar:3.6.0:compile
[INFO] |  |     +- (com.mysema.querydsl:querydsl-core:jar:3.6.0:compile - omitted for duplicate)
[INFO] |  |     +- com.mysema.codegen:codegen:jar:0.6.5:compile
[INFO] |  |     |  +- (com.google.guava:guava:jar:18.0:compile - omitted for duplicate)
[INFO] |  |     |  \- org.eclipse.jdt.core.compiler:ecj:jar:4.3.1:compile
[INFO] |  |     \- javax.inject:javax.inject:jar:1:compile
[INFO] |  +- com.mysema.querydsl:querydsl-mongodb:jar:3.6.0:compile
[INFO] |  |  +- (org.mongodb:mongo-java-driver:jar:2.13.3:compile - version managed from 2.10.0; omitted for duplicate)
[INFO] |  |  +- (com.mysema.querydsl:querydsl-core:jar:3.6.0:compile - omitted for duplicate)
[INFO] |  |  \- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.6.1; omitted for duplicate)
[INFO] |  \- (com.googlecode.json-simple:json-simple:jar:1.1.1:compile - omitted for duplicate)
[INFO] +- org.springframework.boot:spring-boot-starter-data-mongodb:jar:1.3.3.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.3.3.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.3.3.RELEASE:compile
[INFO] |  |  |  +- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] |  |  |  \- (org.springframework:spring-context:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.3.3.RELEASE:compile
[INFO] |  |  |  \- (org.springframework.boot:spring-boot:jar:1.3.3.RELEASE:compile - omitted for duplicate)
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.3.3.RELEASE:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.1.5:compile
[INFO] |  |  |  |  +- ch.qos.logback:logback-core:jar:1.1.5:compile
[INFO] |  |  |  |  \- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.6.1; omitted for duplicate)
[INFO] |  |  |  +- org.slf4j:jcl-over-slf4j:jar:1.7.16:compile
[INFO] |  |  |  |  \- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.6.1; omitted for duplicate)
[INFO] |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.16:compile
[INFO] |  |  |  |  \- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.6.1; omitted for duplicate)
[INFO] |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.16:compile
[INFO] |  |  |     \- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.6.1; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.16:runtime
[INFO] |  +- org.mongodb:mongo-java-driver:jar:2.13.3:compile
[INFO] |  \- (org.springframework.data:spring-data-mongodb:jar:1.8.4.RELEASE:compile - version managed from 1.8.0.RELEASE; omitted for duplicate)
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.3.3.RELEASE:test
[INFO] |  +- (junit:junit:jar:4.12:compile - version managed from 4.10; scope updated from test; omitted for duplicate)
[INFO] |  +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] |  |  +- (org.hamcrest:hamcrest-core:jar:1.3:compile - version managed from 1.1; scope updated from test; omitted for duplicate)
[INFO] |  |  \- org.objenesis:objenesis:jar:2.1:test
[INFO] |  +- (org.hamcrest:hamcrest-core:jar:1.3:compile - version managed from 1.1; scope updated from test; omitted for duplicate)
[INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] |  |  \- (org.hamcrest:hamcrest-core:jar:1.3:compile - version managed from 1.1; scope updated from test; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-core:jar:4.2.5.RELEASE:test - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] |  \- (org.springframework:spring-test:jar:4.2.5.RELEASE:test - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] +- org.springframework:spring-web:jar:4.2.5.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:4.2.5.RELEASE:compile
[INFO] |  |  +- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  \- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] |  +- org.springframework:spring-beans:jar:4.2.5.RELEASE:compile
[INFO] |  |  \- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] |  +- org.springframework:spring-context:jar:4.2.5.RELEASE:compile
[INFO] |  |  +- (org.springframework:spring-aop:jar:4.2.5.RELEASE:compile - omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] |  |  \- (org.springframework:spring-expression:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  \- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] +- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] |  \- junit:junit:jar:4.12:compile (version managed from 4.10)
[INFO] |     \- org.hamcrest:hamcrest-core:jar:1.3:compile (version managed from 1.1)
[INFO] +- org.apache.commons:commons-lang3:jar:3.3.2:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.2.1-atlassian-2:compile
[INFO] |  +- org.apache.httpcomponents:httpcore:jar:4.4.4:compile (version managed from 4.2.1)
[INFO] |  \- commons-codec:commons-codec:jar:1.6:compile
[INFO] +- com.atlassian.jira:jira-rest-java-client-core:jar:3.0.0:compile
[INFO] |  +- (com.atlassian.jira:jira-rest-java-client-api:jar:3.0.0:compile - omitted for conflict with 2.0.0)
[INFO] |  +- com.sun.jersey:jersey-client:jar:1.5:compile
[INFO] |  |  \- com.sun.jersey:jersey-core:jar:1.5:compile
[INFO] |  +- com.sun.jersey:jersey-json:jar:1.5:compile
[INFO] |  |  +- (com.sun.jersey:jersey-core:jar:1.5:compile - omitted for duplicate)
[INFO] |  |  +- org.codehaus.jettison:jettison:jar:1.1:compile
[INFO] |  |  +- com.sun.xml.bind:jaxb-impl:jar:2.2.3:compile
[INFO] |  |  |  \- javax.xml.bind:jaxb-api:jar:2.2.2:compile
[INFO] |  |  |     +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] |  |  |     \- javax.activation:activation:jar:1.1:compile
[INFO] |  |  +- org.codehaus.jackson:jackson-core-asl:jar:1.5.5:compile
[INFO] |  |  +- org.codehaus.jackson:jackson-mapper-asl:jar:1.5.5:compile
[INFO] |  |  |  \- (org.codehaus.jackson:jackson-core-asl:jar:1.5.5:compile - omitted for duplicate)
[INFO] |  |  +- org.codehaus.jackson:jackson-jaxrs:jar:1.5.5:compile
[INFO] |  |  |  +- (org.codehaus.jackson:jackson-core-asl:jar:1.5.5:compile - omitted for duplicate)
[INFO] |  |  |  \- (org.codehaus.jackson:jackson-mapper-asl:jar:1.5.5:compile - omitted for duplicate)
[INFO] |  |  \- org.codehaus.jackson:jackson-xc:jar:1.5.5:compile
[INFO] |  |     +- (org.codehaus.jackson:jackson-core-asl:jar:1.5.5:compile - omitted for duplicate)
[INFO] |  |     \- (org.codehaus.jackson:jackson-mapper-asl:jar:1.5.5:compile - omitted for duplicate)
[INFO] |  +- joda-time:joda-time:jar:2.8.2:compile
[INFO] |  +- com.atlassian.httpclient:atlassian-httpclient-apache-httpcomponents:jar:0.13.2:compile
[INFO] |  |  +- (com.atlassian.httpclient:atlassian-httpclient-api:jar:0.13.2:compile - omitted for duplicate)
[INFO] |  |  +- com.atlassian.sal:sal-api:jar:2.7.0:compile
[INFO] |  |  +- com.atlassian.event:atlassian-event:jar:2.2.0:compile
[INFO] |  |  |  +- (com.atlassian.util.concurrent:atlassian-util-concurrent:jar:0.0.12:compile - omitted for conflict with 2.4.0-M9)
[INFO] |  |  |  +- (com.google.guava:guava:jar:10.0.1:compile - omitted for duplicate)
[INFO] |  |  |  +- (commons-lang:commons-lang:jar:2.4:compile - omitted for conflict with 2.5)
[INFO] |  |  |  \- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.5.8; omitted for duplicate)
[INFO] |  |  +- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.6.4; omitted for duplicate)
[INFO] |  |  +- org.apache.httpcomponents:httpasyncclient-cache:jar:4.0-beta3-atlassian-1:compile
[INFO] |  |  |  +- (org.apache.httpcomponents:httpasyncclient:jar:4.0-beta3-atlassian-1:compile - omitted for duplicate)
[INFO] |  |  |  \- (org.apache.httpcomponents:httpclient-cache:jar:4.2.1-atlassian-2:compile - omitted for duplicate)
[INFO] |  |  +- org.apache.httpcomponents:httpclient-cache:jar:4.2.1-atlassian-2:compile
[INFO] |  |  |  +- (org.apache.httpcomponents:httpclient:jar:4.2.1-atlassian-2:compile - omitted for duplicate)
[INFO] |  |  |  \- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for duplicate)
[INFO] |  |  +- org.apache.httpcomponents:httpasyncclient:jar:4.0-beta3-atlassian-1:compile
[INFO] |  |  |  \- (org.apache.httpcomponents:httpclient:jar:4.2.1-atlassian-2:compile - omitted for duplicate)
[INFO] |  |  +- (org.apache.httpcomponents:httpcore:jar:4.4.4:compile - version managed from 4.2.2; omitted for duplicate)
[INFO] |  |  +- org.apache.httpcomponents:httpcore-nio:jar:4.2.2:compile
[INFO] |  |  |  \- (org.apache.httpcomponents:httpcore:jar:4.4.4:compile - version managed from 4.2.2; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-context:jar:4.2.5.RELEASE:compile - version managed from 2.5.6; omitted for duplicate)
[INFO] |  |  \- (org.apache.httpcomponents:httpmime:jar:4.2.1-atlassian-2:compile - version managed from 4.1.2; omitted for duplicate)
[INFO] |  +- com.atlassian.util.concurrent:atlassian-util-concurrent:jar:2.4.0-M9:compile
[INFO] |  +- org.apache.httpcomponents:httpmime:jar:4.2.1-atlassian-2:compile
[INFO] |  \- com.google.guava:guava:jar:10.0.1:compile
[INFO] |     \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] +- com.atlassian.jira:jira-rest-java-client-api:jar:2.0.0:compile
[INFO] |  +- (com.atlassian.util.concurrent:atlassian-util-concurrent:jar:2.4.0-M9:compile - omitted for duplicate)
[INFO] |  +- com.atlassian.httpclient:atlassian-httpclient-api:jar:0.13.2:compile
[INFO] |  |  +- com.atlassian.httpclient:atlassian-httpclient-spi:jar:0.13.2:compile
[INFO] |  |  +- (com.google.guava:guava:jar:10.0.1:compile - omitted for duplicate)
[INFO] |  |  \- (com.atlassian.util.concurrent:atlassian-util-concurrent:jar:2.4.0:compile - omitted for conflict with 2.4.0-M9)
[INFO] |  +- (joda-time:joda-time:jar:2.8.2:compile - version managed from 1.6; omitted for duplicate)
[INFO] |  \- (com.google.guava:guava:jar:10.0.1:compile - omitted for duplicate)
[INFO] \- net.rcarz:jira-client:jar:0.5:compile
[INFO]    +- (org.apache.httpcomponents:httpclient:jar:4.2.1-atlassian-2:compile - version managed from 4.2.5; omitted for duplicate)
[INFO]    +- (org.apache.httpcomponents:httpmime:jar:4.2.1-atlassian-2:compile - version managed from 4.2.5; omitted for duplicate)
[INFO]    +- net.sf.json-lib:json-lib:jar:jdk15:2.4:compile
[INFO]    |  +- commons-beanutils:commons-beanutils:jar:1.9.2:compile (version managed from 1.8.0)
[INFO]    |  |  \- (commons-collections:commons-collections:jar:3.2.2:compile - version managed from 3.2.1; omitted for duplicate)
[INFO]    |  +- commons-collections:commons-collections:jar:3.2.2:compile
[INFO]    |  +- commons-lang:commons-lang:jar:2.5:compile
[INFO]    |  +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO]    |  \- net.sf.ezmorph:ezmorph:jar:1.0.6:compile
[INFO]    |     \- (commons-lang:commons-lang:jar:2.3:compile - omitted for conflict with 2.5)
[INFO]    +- (joda-time:joda-time:jar:2.8.2:compile - version managed from 2.3; omitted for duplicate)
[INFO]    +- (junit:junit:jar:4.12:compile - version managed from 4.8.2; omitted for duplicate)
[INFO]    +- org.mockito:mockito-all:jar:1.9.0:compile
[INFO]    \- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO]       +- (commons-logging:commons-logging:jar:1.0.4:compile - omitted for conflict with 1.1.1)
[INFO]       \- (commons-codec:commons-codec:jar:1.2:compile - omitted for conflict with 1.6)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:40 min
[INFO] Finished at: 2016-04-27T16:19:12+05:30
[INFO] Final Memory: 20M/98M
[INFO] ------------------------------------------------------------------------

C:\Users\praveen.joshi\git\dashboard\jira-poc>

2 个答案:

答案 0 :(得分:1)

我在依赖树中看到了几个问题。第一。 org.apache.httpcomponents:httpcore:jar:4.4.4:compile - version managed from 4.2.2。从管理的版本意味着 httpcore应该有4.2.2版本,但是有人改了它。它可能是问题的根源。 您是否将httpcore的版本更改为4.4.4?其次。你添加了 与com.atlassian.jira:jira-rest-java-client-api版本的2.0.0依赖关系,com.atlassian.jira:jira-rest-java-client-core版本与3.0.0版本一起使用。我觉得你 可以从pom.xml中删除com.atlassian.jira:jira-rest-java-client-api依赖项或将其升级到3.0.0。另请注意,您引用的示例项目使用2.0.0-m25jira-rest-java-client-corejira-rest-java-client-api

答案 1 :(得分:1)

你错过了pom中的一些依赖项。加上这个:

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-json</artifactId>
        <version>1.5</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-client</artifactId>
        <version>1.9</version>
    </dependency>
    <dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-rest-java-client-api</artifactId>
        <version>3.0.0</version>
    </dependency>
    <dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-rest-java-client-core</artifactId>
        <version>3.0.0</version>
    </dependency>
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>14.0-rc1</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.jettison</groupId>
        <artifactId>jettison</artifactId>
        <version>1.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.6.4</version>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4</version>
    </dependency>
</dependencies>

然后你可以这样调用你的代码:

public Issue getIssue(String issueKey) throws Exception
{
    final URI jiraServerUri = new URI("https://jira-domain");
    final JiraRestClient restClient = new AsynchronousJiraRestClientFactory().createWithBasicHttpAuthentication(jiraServerUri, "user@domain.com", "password");
    Promise issuePromise = restClient.getIssueClient().getIssue(issueKey);
    return Optional.ofNullable((Issue) issuePromise.claim()).orElseThrow(() -> new Exception("No such issue"));
}

我假设您已经将所需的存储库和插件存储库添加到您的maven settings.xml中(或者您也可以将它们添加到您的pom.xml中):

        <repositories>
           <repository>
                <id>atlassian-public</id>
                <url>https://m2proxy.atlassian.com/repository/public</url>
                <snapshots>
                    <enabled>true</enabled>
                    <updatePolicy>daily</updatePolicy>
                    <checksumPolicy>warn</checksumPolicy>
                </snapshots>
                <releases>
                    <enabled>true</enabled>
                    <checksumPolicy>warn</checksumPolicy>
                </releases>
            </repository>
        </repositories>

    <pluginRepositories>                
            <pluginRepository>
                <id>atlassian-public</id>
                <url>https://m2proxy.atlassian.com/repository/public</url>
                <releases>
                    <enabled>true</enabled>
                    <checksumPolicy>warn</checksumPolicy>
                </releases>
                <snapshots>
                    <checksumPolicy>warn</checksumPolicy>
                </snapshots>
            </pluginRepository>
        </pluginRepositories>

在此处查找完整代码:https://github.com/somaiah/jrjc