JIRA Scripting API
Provides scripting access to JIRA using JIRA's Client API (JRJC) |
Type | JAR |
Category | API |
Developed by | |
Active Installs | 2 |
Rating | |
License | GNU Lesser General Public License 2.1 |
Compatibility |
|
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
Check also the JRJC Tutorial and JRJC Javadoc.
Example without being authenticated
Velocity:
#set ($client = $services.jira.getJiraRestClient("<jira configuration id>"))
#set ($pm = $services.jira.getNullProgressMonitor())
#set ($issue = $client.getIssueClient().getIssue("XWIKI-1000", $pm))
Summary: $issue.summary
{{/velocity}}
Note that in order to define a <jira configuration id> you'll need to install and use the JIRA Administration application.
Groovy:
import com.atlassian.jira.rest.client.*
import org.xwiki.contrib.jira.config.*
def client = services.get("jira").getJiraRestClient(new JIRAServer("https://jira.xwiki.org/"))
def pm = new NullProgressMonitor();
def issue = client.getIssueClient().getIssue("XWIKI-1000", pm);
println "Summary: ${issue.getSummary()}"
{{/groovy}}
Example with Authentication
Velocity:
#set ($client = $services.jira.getJiraRestClient("<jira configuration id>"))
...
{{/velocity}}
Groovy:
...
def client = services.get("jira").getJiraRestClient(new JIRAServer("https://jira.xwiki.org/", "username", "password"))
...
{{/groovy}}
Example to find all issues matching a JQL query
Velocity:
#set ($client = $services.jira.getJiraRestClient("<jira configuration id>"))
#set ($pm = $services.jira.getNullProgressMonitor())
|=Key
#foreach ($basicIssue in $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())
|$basicIssue.getKey()
#end
{{/velocity}}
Groovy:
import com.atlassian.jira.rest.client.*
import com.atlassian.jira.rest.client.domain.*
def client = services.get("jira").getJiraRestClient(new JIRAServer("https://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}}
Prerequisites & Installation Instructions
We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).
You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.
Dependencies
Dependencies for this extension (org.xwiki.contrib.jira:jira-api 9.0):
- org.xwiki.contrib.jira:jira-config-api 9.0
- org.xwiki.commons:xwiki-commons-script 14.10.20
- org.xwiki.commons:xwiki-commons-properties 14.10.20
- com.google.guava:guava 31.1-jre
- com.google.errorprone:error_prone_annotations 2.16
- org.checkerframework:checker-qual 3.27.0
- com.atlassian.jira:jira-rest-java-client-app 5.2.7
- jakarta.xml.bind:jakarta.xml.bind-api 2.3.3
- org.glassfish.jaxb:jaxb-runtime 2.3.7
- org.xwiki.commons:xwiki-commons-tool-test-component 14.10.20