Get JIRA Software version from JAVA API

Neal Riley April 30, 2017

Seems like an easy one, but I'm at a loss. What's the most intelligent way for an addon (or ScriptRunner groovy script) to determine what version of JIRA Software is currently installed? 

1 answer

1 accepted

3 votes
Answer accepted
Gareth Cantrell
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.
May 2, 2017

In ScriptRunner, the following script will get the current version:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.application.JiraApplicationManager

ComponentAccessor.getComponent(JiraApplicationManager.class).getPlatform().getVersion()

Update:

Probably a better implementation using the BuildUtilsInfo class:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.util.BuildUtilsInfo
    
ComponentAccessor.getComponent(BuildUtilsInfo.class).getVersion()

 

Neal Riley May 2, 2017

Thanks Gareth, this is perfect!  I was having trouble tracking down the most-recent way to do it since the 7.0 launch of JIRA.  

Much appreciated! 

Suggest an answer

Log in or Sign up to answer