How to use Jira-rest-java-client with Jersey 2

962 views Asked by At

I'm trying to use Jira Rest Client with an existing Jersey project. But it is causing dependency conflicts.

pom.xml:

<dependency>
  <groupId>org.glassfish.jersey.containers</groupId>
  <artifactId>jersey-container-servlet</artifactId>
  <version>2.24.1</version>
</dependency>
<dependency>
  <groupId>com.atlassian.jira</groupId>
  <artifactId>jira-rest-java-client-core</artifactId>
  <version>2.0.0-m30</version>
</dependency>

The above dependencies result in the exception:

root cause: java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;

If I exclude com.sun.jersey:jersey-client the former error does go away.

<dependency>
  <groupId>com.atlassian.jira</groupId>
  <artifactId>jira-rest-java-client</artifactId>
  <version>1.2-m01</version>
  <exclusions>
    <exclusion>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-client</artifactId>
    </exclusion>
  </exclusions>
</dependency>

But then it cause in another exception. org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: com/atlassian/fugue/Effect

Is there any workaround for me to get Jira client work along with Jersey 2?

1

There are 1 answers

1
RottenCode On BEST ANSWER

There are two dependencies to exclude from atlassian jira rest client:

      <dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-rest-java-client-core</artifactId>
        <version>5.1.2-2bd0a62e</version>
        <exclusions>
          <exclusion>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-client</artifactId>
          </exclusion>
          <exclusion>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-json</artifactId>
          </exclusion>
        </exclusions>
      </dependency>

The other issue you gotten can be solved by adding this dependency:

      <dependency>
        <groupId>io.atlassian.fugue</groupId>
        <artifactId>fugue</artifactId>
        <version>4.7.2</version>
        <scope>provided</scope>
      </dependency>