Search code examples
javajirajira-rest-apijira-rest-java-api

Unable to create a JiraRestClient


I am trying to create a JiraRestClient using Basic authentication.

JiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();
URI jiraServerUri = getJiraUri();
JiraRestClient restClient =  factory
 .createWithBasicHttpAuthentication(jiraServerUri, USERNAME, PASSWORD);

However, I am getting the below exception:

Exception in thread "main" java.lang.NoSuchMethodError: com.atlassian.fugue.Option.fold(Lcom/google/common/base/Supplier;Lcom/google/common/base/Function;)Ljava/lang/Object;
    at com.atlassian.httpclient.apache.httpcomponents.proxy.ProxyConfigFactory.getProxyHost(ProxyConfigFactory.java:16)
    at com.atlassian.httpclient.apache.httpcomponents.ApacheAsyncHttpClient.<init>(ApacheAsyncHttpClient.java:211)
    at com.atlassian.httpclient.apache.httpcomponents.ApacheAsyncHttpClient.<init>(ApacheAsyncHttpClient.java:123)
    at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClientFactory.doCreate(DefaultHttpClientFactory.java:68)
    at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClientFactory.create(DefaultHttpClientFactory.java:35)
    at com.atlassian.jira.rest.client.internal.async.AsynchronousHttpClientFactory.createClient(AsynchronousHttpClientFactory.java:63)
    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.jira.JiraClient.getJiraRestClient(JiraClient.java:37)
    at com.jira.JiraClient.getIssue(JiraClient.java:25)
    at com.jira.JiraClient.main(JiraClient.java:20)

It seems that some runtime dependency is missing. But not sure which one.

Here is the snippet from my pom:

<dependencies>
    <dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-rest-java-client-core</artifactId>
        <version>4.0.0</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>com.atlassian.fugue</groupId>
        <artifactId>fugue</artifactId>
        <version>3.0.0-m007</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.6.4</version>
    </dependency>
</dependencies>
<repositories>
    <repository>
        <id>atlassian-public</id>
        <url>https://packages.atlassian.com/maven/repository/public</url>
    </repository>
</repositories>

What am I missing here?


Solution

  • The version of fugue compatible with JRJC 4.0.0is 2.6.1

    <dependency>
        <groupId>com.atlassian.fugue</groupId>
        <artifactId>fugue</artifactId>
        <version>2.6.1</version>
    </dependency>