The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Script Runner - Script Console - Samples - Get JIRA Version

Onder Ozcan
Contributor
October 7, 2019

Dear Community,

I have a noddy question. I've just installed the script runner and I'm trying to get my head around. When I follow "Get JIRA Version" sample from the documentation (https://scriptrunner-docs.connect.adaptavist.com/jira/script-console.html) I get the error below. Can you please guide me about it? Thank you.

input:

get('/rest/api/2/serverInfo') 
.queryString('doHealthCheck', 'true')
.asObject(Map)
.body
.version

 

output:

groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.get() is applicable for argument types: (java.lang.String) values: [/rest/api/2/serverInfo] Possible solutions: get(java.lang.String), getAt(java.lang.String), grep(), put(java.lang.String, java.lang.Object), grep(java.lang.Object), wait() at Script8.run(Script8.groovy:1)

 

Kind regards,

Onder

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Tuncay Senturk _Snapbytes_
Community Champion
October 7, 2019

Hello @Onder Ozcan 

Welcome to the community.

I think you're using Jira Server but you're trying to run Script Runner cloud version code examples.

AFAIK those get, post, put, ... http methods can be used without adding any import statements in script console for cloud version of Script Runner. I'm not good at cloud though.

But in server edition you need to add some REST library imports.

However, if you want to get the version of Jira using script console, you can use below script.

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.util.BuildUtilsInfo

BuildUtilsInfo buildUtils = ComponentAccessor.getComponent(BuildUtilsInfo.class)
return buildUtils.version

 But, if you need to do it via REST, I can also try to help. 

I hope I was helpful.

Cheers

Tuncay

Onder Ozcan
Contributor
October 8, 2019

Hi @Tuncay Senturk _Snapbytes_ 

It does do the job. Thank you for your help.

Cheers,

Onder

Tuncay Senturk _Snapbytes_
Community Champion
October 8, 2019

I'm glad that it does the trick ;)