2016-04-26 69 views
1

我想在我的項目中使用Jira Rest Java Client。但無法連接到我安裝的jira。在使用下面的代碼片段:JRJC拋出NoClassDefFound異常

JiraRestClientFactory factory = new AsynchronousJiraRestClientFactory(); 
JiraRestClient restClient =factory.createWithBasicHttpAuthentication(serverURI, "praveen", 
"[email protected]"); 

我面臨着一個錯誤陳述如下:

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> 
+1

運行'MVN DEPE在您的項目根目錄中輸入「dverbose」並將輸出連接到此問題 – Ilya

+0

沒有得到任何東西.. –

+0

您應該在pom.xml級別上運行它 – Ilya

回答

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-core3.0.0版本配合使用。我想你 可以從pom.xml中刪除com.atlassian.jira:jira-rest-java-client-api依賴關係,或將其升級到3.0.0。另請注意,您參考的示例項目使用2.0.0-m25版本的jira-rest-java-client-corejira-rest-java-client-api

+0

我嘗試使用2.0.0-m25,但它不工作。 此外,現在可用的版本是4.0.0。 我使用性能如下: \t \t 4.0-β3-Atlassian的-1 \t \t 4.2.1-Atlassian的-2 \t \t 1.7 \t

+0

用2.0.0-m25獲得什麼? – Ilya

+0

我得到一個異常NoClasDefFound .. –

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, "[email protected]", "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

+0

這些依賴關係已經存在。 –

+0

依賴關係存在,但版本不兼容。你試過我的代碼嗎? –

+0

只有當你看到我提到的例子時,我才使用它們。 atlassian不提供任何幫助。或者他們有任何論壇。 –