Jira plugin using Jersey client for REST call to external resource.

In my JIRA plugin I want to GET an external resource from 3rd party site (for example https://api.twitter.com/1.1/statuses/mentions_timeline.json?count=2&since_id=14927799, but much simpler).

After I was unable to make an HTTP request directly from JIRA I made my choice for Jersey (Jira REST API uses it too). I defined my simple resource

@XmlRootElement
public class ValidatorResource {
	public String response; //yes, no
	
	public ValidatorResource(String response){
		this.response = response; 
	}
}

And according to Jersey tutorial I configured a client for retrieving it as JSON:

ClientConfig client_config = new DefaultClientConfig(); 
		client_config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE); 
		Client client = Client.create(new DefaultClientConfig());

But both Eclipse and Jira tell me that:

"The type com.sun.jersey.core.util.FeaturesAndProperties cannot be resolved. It is indirectly referenced from required .class files"

I am not a maven guru, it should be something with dependencies. After hours of googling I am giving up. My plugin dependencies are:

<dependency>
			<groupId>javax.ws.rs</groupId>
			<artifactId>jsr311-api</artifactId>
			<version>1.1.1</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.xml.bind</groupId>
			<artifactId>jaxb-api</artifactId>
			<version>2.1</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.sun.jersey</groupId>
			<artifactId>jersey-json</artifactId>
			<version>1.13</version>
		</dependency>
		<dependency>
			<groupId>com.sun.jersey</groupId>
			<artifactId>jersey-client</artifactId>
			<version>1.13</version>
		</dependency>

2 answers

This widget could not be displayed.

Hello!

Do you resolve your problem? At this moment I have same problem. It will be great, if you can help me. Thanks

This widget could not be displayed.

Hi Peter, Hi Maxim,

did you try to include atlassians version of jersey? I was sucessful with the following modifications to my pom:

First add atlassians maven repository

<project>
......
  <repositories>
        <repository>
            <id>atlassian-public</id>
            <url>https://maven.atlassian.com/repository/public</url>
        </repository>
    </repositories>
.....
</project>

Second add dependencies to the atlassian version

<dependency>
          <groupId>com.sun.jersey</groupId>
          <artifactId>jersey-client</artifactId>
          <version>1.8-atlassian-11</version>
      </dependency>
 
      <dependency>
          <groupId>com.sun.jersey</groupId>
          <artifactId>jersey-json</artifactId>
          <version>1.8-atlassian-11</version>
      </dependency>
 
      <dependency>
          <groupId>com.sun.jersey</groupId>
          <artifactId>jersey-core</artifactId>
          <version>1.8-atlassian-11</version>
      </dependency>

Keep me updated if it works.

Best regards Philipp

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Thursday in United States

Local Atlassian Research Workshop opportunity on Sep. 28th

We're looking for participants for another workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sh...

37 views 0 0
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you