-1
私はJIRAと接続して問題を作成しようとしています。私は同じコードを書いていますが、問題があります。Javaを使用したJIRAの問題を見つけよう
のpom.xml
<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>com.fis.poc</groupId>
<artifactId>JIRATEST1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>JIRATEST1</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.atlassian.sal/sal-api -->
<!-- https://mvnrepository.com/artifact/com.atlassian.sal/sal-api -->
<!-- <dependency>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
<version>2.10.0</version>
</dependency> -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient-cache</artifactId>
<version>4.2.1-atlassian-2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient-cache</artifactId>
<version>4.2</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160810</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
<version>2.7.1</version>
</dependency>
<dependency>
<groupId>com.atlassian.httpclient</groupId>
<artifactId>atlassian-httpclient-spi</artifactId>
<version>0.17.0-m01</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore-nio</artifactId>
<version>4.0-alpha6</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.1.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore-nio</artifactId>
<version>4.4.5</version>
</dependency>
<dependency>
<groupId>com.atlassian.httpclient</groupId>
<artifactId>atlassian-httpclient-apache-httpcomponents</artifactId>
<version>0.11.0</version>
</dependency>
<dependency>
<groupId>com.atlassian.httpclient</groupId>
<artifactId>atlassian-httpclient-api</artifactId>
<version>0.23.2</version>
</dependency>
<dependency>
<groupId>com.atlassian.event</groupId>
<artifactId>atlassian-event</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>com.atlassian.util.concurrent</groupId>
<artifactId>atlassian-util-concurrent</artifactId>
<version>3.0.0</version>
</dependency>
<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-core</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-rest-java-client-api</artifactId>
<version>4.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>
</project>
と私はいくつかの問題についての情報を取得するためのJavaコードを記述します。これはすでにJIRAで作成されています。私はURIとユーザー名とパスワードの静的変数を入れました。
public static void main(String[] args) throws Exception {
Issue issue = getIssue("TEST_12332");
}
public static Issue getIssue(String issueKey) throws Exception{
final URI jiraServerUri = new URI(JIRA_URL);
final JiraRestClient restClient = new AsynchronousJiraRestClientFactory().createWithBasicHttpAuthentication(jiraServerUri, JIRA_ADMIN_USERNAME, JIRA_ADMIN_PASSWORD);
Promise issuePromise = restClient.getIssueClient().getIssue(issueKey);
return (Issue)issuePromise.claim();
// return Optional.ofNullable((Issue) issuePromise.claim()).orElseThrow(() -> new Exception("No such issue"));
}
しかし、私はエラーました:今、そのは正常に動作し、私は私があるため、リポジトリ間違った瓶の使用不能の私pom.I事でhttps://m2proxy.atlassian.com/repository/publicリポジトリを追加する必要が間違っていたdownloaded.Now
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.http.impl.client.cache.CacheConfig.setNeverCache1_0ResponsesWithQueryString(Z)V
at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClient.<init>(DefaultHttpClient.java:155)
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.fis.poc.JIRATEST1.JiraTest.getIssue(JiraTest.java:37)
at com.fis.poc.JIRATEST1.JiraTest.main(JiraTest.java:28)
これは役に立ちますか? http://stackoverflow.com/questions/18249767/apache-client-cache-jar –