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

Hello!

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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Friday in Off-topic

Friday Fun: Riddle me this

Happy Friday, Funmakers! We had a Community Team offsite in Austin this week, and my mind feels primed for thinkin' from all the brainstorming we did!  So, this week's Friday Fun thread w...

121 views 14 3
Join discussion

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