Version 9.1 by Vincent Massol on 2011/09/20 17:23

cogProvides scripting access to JIRA using JIRA's Client API (JRJC)
Typecomponents
Category
Developed byUnknown
Rating
0 Votes
LicenseUnknown

Description

This module exposes the JRJC API to XWiki scripts. JRJC is a Java library to easily access a JIRA instance (Internally it uses the JIRA REST API).

Examples

Velocity example without being authenticated

{{velocity}}
#set ($client = $services.jira.getJiraRestClient("http://jira.xwiki.org/"))
#set ($issue = $client.getIssueClient().getIssue("XWIKI-1000", $services.jira.getNullProgressMonitor()))

Summary: $issue.summary
{{/velocity}}

Groovy example without being authenticated

{{groovy}}
import com.atlassian.jira.rest.client.*

def client = services.get("jira").getJiraRestClient("http://jira.xwiki.org/")
def pm = new NullProgressMonitor();
def issue = client.getIssueClient().getIssue("XWIKI-1000", pm);

println "Summary: ${issue.getSummary()}"
{{/groovy}}

Groovy Example with Authentication

{{groovy}}
...
def client = services.get("jira").getJiraRestClient("http://jira.xwiki.org/", "username", "password")
...
{{/groovy}}

Find all issues matching a JQL query

{{groovy}}
import com.atlassian.jira.rest.client.*
import com.atlassian.jira.rest.client.domain.*

def client = services.get("jira").getJiraRestClient("http://jira.xwiki.org/")
def pm = new NullProgressMonitor()
def issueClient = client.getIssueClient()

println "|=Key"
client.getSearchClient().searchJql("project = XWIKI AND status = Closed and fixVersion in ('3.2 M1', '3.2 M2', '3.2 M3', '3.2 RC1', '3.2') ORDER BY priority DESC", pm).getIssues().each() { basicIssue ->
  println "|${basicIssue.getKey()}"
}
{{/groovy}}

From the JRJC documentation:

 Currently JRJC fully supports only Basic HTTP authentication (other means are coming soon), which means that you should not use it in public networks without encryption as your credentials more or less travel in the open text (just encoded with Base64). Thus use HTTPS to talk to your JIRA whenever possible. Use HTTP only in internal, private networks or for tests.

Check also the JRJC Tutorial and JRJC Javadoc.

Prerequisites & Installation Instructions

This modules requires a lot of dependencies to be present in order to work. However it's simple to install using the Extension Manager.

Follow these steps:

  1. Configure the Extension Manager to use the Atlassian and Java.Net Maven repositories. To do this edit your xwiki.properties file and add:
    extension.repositories=maven-xwiki-snapshots:maven:http://nexus.xwiki.org/nexus/content/groups/public-snapshots
    extension.repositories=maven-xwiki-release:maven:http://nexus.xwiki.org/nexus/content/groups/public
    extension.repositories=atlassian:maven:https://maven.atlassian.com/content/repositories/atlassian-public/
    extension.repositories=javanet:maven:http://download.java.net/maven/2/
  2. Go the Admin page, select Extension Manager and use the artifact id org.xwiki.platform:xwiki-platform-jira and version 3.2 then click on the Install button

Get Connected