Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to use JRJC in a non-maven project?

Susanne Quiel August 7, 2013

Hi there, I'm trying to integrate a Jira-Connection into one of our internal tools. Unfortunately, this tool is not set up in maven, only in svn. What do I need to do to use JRJC for getting acces to our Jira? Can I simply include the .jar from https://marketplace.atlassian.com/plugins/com.atlassian.jira.jira-rest-java-client in the project library and build path from our tool? Thx in advance 4 your help.

5 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Aleksander Mierzwicki
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 8, 2013

It should work in non-maven project. The easiest way would be to clone JRJC, checkout some released tag and run mvn:dependency:copy-dependencies

git clone git@bitbucket.org:atlassian/jira-rest-java-client.git
cd jira-rest-java-client
git checkout jira-rest-java-client-parent-2.0.0-m25
mvn dependency:copy-dependencies

After that the all dependencies should be in core/target/dependency/. Just use them in your project with JRJC jar.

0 votes
nat ter July 2, 2014

Hi guys. I've been trying to compile a few of the JRJC examples with little luck. What I'd like to do is to download all the dependencies as jar files and compile (without maven!). Andy Brook has kindly provided a pom.xml above. Is there a way of using this to download all the jar files? I'm new to this so please be patient with me (:

Thanks for your help in advance. Nat

0 votes
Susanne Quiel August 13, 2013

Thank you, I will try that. :-)

0 votes
Andy Brook
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 8, 2013

Of course you can use it in your non-maven project (but why not use maven!). The only problem you have is satisfying that projects required dependencies as described in its pom.xml. If you manually download all these, and include in your 'app' classpath, it will work just fine. And when you move to the next version of JRJC, you'll of course remember to look for new dependencies and manually download/integrate them again right? (maven will help here!)

0 votes
RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 7, 2013

another wat you can create rest client use java and jersy

package com.rest.client;
 
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
 
public class RESTclient {
 
    public static void main(String[] args) {
        try {
 
            Client client = Client.create();           
            client.addFilter(new HTTPBasicAuthFilter("username", "password"));
            WebResource webResource = client.resource("http://localhosr:8080/rest/api/2/issue");           
            String input="{\"fields\":{\"project\":{\"key\":\"JIRA\"},\"summary\":\"Test Ticket\",\"description\":\"This is a test CR\", \"reporter\": {\"name\": \"prasad\"},\"issuetype\":{\"name\":\"Defect\"},\"versions\":[{\"name\":\"1.0\"}],\"customfield_10692\":{\"value\":\"Stability\"},\"customfield_10430\":{\"value\":\"Stability\"},\"customfield_10005\":{\"value\":\"Blocker\"},\"components\":[{\"name\":\"TEST\"}]}}";     
            ClientResponse response = webResource.type("application/json").post(ClientResponse.class, input);
     
            String output = response.getEntity(String.class);
 
            System.out.println("Output from Server .... \n");
            System.out.println(output);
 
        } catch (Exception e) {
 
            e.printStackTrace();
 
        }
 
    }
}

Susanne Quiel August 8, 2013

Thank you for your answer. I know there are other ways apart from JRJC to use the rest api, but since atlassian provides the JRJC I would really like to use it. So, anyone knows the answer to my question? :)

nat ter July 2, 2014

I've downloaded Jersey JAX-RS 2.0 RI bundle and have all the jar files in my classpath but when trying to compile your code, I get errors like:

RESTclient.java:3: error: package com.sun.jersey.api.client does not exist
import com.sun.jersey.api.client.Client;
^
RESTclient.java:4: error: package com.sun.jersey.api.client does not exist
import com.sun.jersey.api.client.ClientResponse;
^
RESTclient.java:5: error: package com.sun.jersey.api.client does not exist
import com.sun.jersey.api.client.WebResource;
^
RESTclient.java:6: error: package com.sun.jersey.api.client.filter does not exist
import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
^

Is this because names have changed between versions? Which version did you use? Could you point me to where I can get jars?

Thanks for your help

Nathan

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events