How to include groovy scripts in jira add-on and run it in script runner

Denis Makarov May 13, 2016

Hello.

I'am new to using groovy script runner and i use this plugin to do post functions. I want to wrap my groovy scripts in plugin. This is needed for version control and convenient maintenence these scripts.

How to make script runner identify scripts that located in plugin?

Thanks in advance for your support. 

1 answer

1 accepted

2 votes
Answer accepted
JamieA
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 15, 2016

Did you read https://scriptrunner.adaptavist.com/latest/jira/creating-a-script-plugin.html ? Warning though: that documentation needs some work, I don't know if it will work as written. But that's where you should be looking.

The other alternative is to make sure your "scripts" directory is a git repo, then you can just checkout the latest version or a floating label when you want to deploy changes.

Denis Makarov May 25, 2016

I've read this article but it doesn't answer the question - how groovy runner will identify scripts that are in the plugin? I created simple Atlassian plugin with groovy "hello world" script, wrote groovy-runner dependencies, specified "plugin.script.roots" in pom.xml and as far as i understand, script should be transferred to this root on jira-server and script runner will execute it. But it doesn't happen. Please, correct me if i wrong,

JamieA
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 26, 2016

It's not copied anywhere, but you should be able to run it from script console using the relative path from the jar root.

On the "files" tab, you should see eg plugin://My Awesome Plugin as well as the usual roots.

Denis Makarov May 26, 2016

Found it, thanks a lot!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events