Hi,
My requirement is to create a macro in confluence using script-runner to get the jira version. I am getting getting error while executing the below script in script-runner console page in confluence.
unable to resolve class com.atlassian.sal.api.net.RequestFactory
unable to resolve class com.atlassian.jira.component.ComponentAccessor
import groovy.json.JsonSlurper
import com.atlassian.sal.api.net.RequestFactory
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.util.BuildUtilsInfo
def jiraBaseUrl = "https://server-hostname"
def jiraApiPath = "/rest/api/2/serverInfo"
/*def requestfact = new RequestFactory()
def response = requestfact.createRequest()
.setMethod("GET")
.setUrl("${jiraBaseUrl}${jiraApiPath}")
.execute()
// Parse the response JSON
def jsonResponse = new JsonSlurper().parseText(response.getResponseBodyAsString()) */
def jiraVersion = jsonResponse.version
def jiraBuildNo = jsonResponse.buildNumber
def jiraBuildDate = jsonResponse.buildDate
log.info("Jira Version: ${jiraVersion}")
log.info("Jira BuildNo: ${jiraBuildNo}")
log.info("Jira BuildDate: ${jiraBuildDate}")
Thanks
Arun