Version 9.1 by Vincent Massol on 2011/09/20 17:23
Provides scripting access to JIRA using JIRA's Client API (JRJC) |
Type | components |
Category | |
Developed by | Unknown |
Rating | |
License | Unknown |
Table of contents
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}}
#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}}
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}}
...
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}}
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}}
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:
- 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/ - 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