Friday, May 24, 2013

Using JIRA API from Groovy

If you need to script some JIRA task, it is very easy to do:

@GrabResolver(name='atlassian', root='')
@Grab( group ='com.atlassian.jira.plugins', module = 'jira-soapclient', version = '4.0' )

import com.atlassian.jira.rpc.soap.client.*

def jira = new JiraSoapServiceServiceLocator().getJirasoapserviceV2(new URL('http://host/rpc/soap/jirasoapservice-v2'))
String token = jira.login('user', 'pass')
println jira.getVersions(token, "PRJ").sort({ it.sequence }).find({ !it.released }).name

which takes latest unreleased version for the project PRJ.

No comments:

Post a Comment