Home
Articles (French)


Atlassian CodeGeist 2007 Entry

This is my attempt at CodeGeist 2007.

JIRA plugin: Groovy Runner

This plugin is providing administrator a panel similar to the Jelly Runner, except it will interpret Groovy code on the JIRA server.
I always found Jelly Script impossible to read and impossible to write, even though I have written some maven 1 plugins using this language, it was particularly painful. XML is definitively not a programming language!
As Groovy is getting to be approved as JSR-241 I thought this would be a good contribution to JIRA, modernizing the available scripting engines available to administrators and plugin developpers.

Usage

Copy the plugin jar to WEB-INF/lib alongside groovy-all-1.0.jar, restart and you are ready to go.
You need to be administrator in order to use the plugin (but you are; isn't it otherwise you should'nt be allowed to install plugins and restart the server.)
Click on 'Administration', and expand the 'Options and settings' category, then choose 'Grovvy Runner'. There is a default script provided to give a feel of what you can do.

Getting feedback

If you want some feedback from the execution, either return an object from the script (a toString() will be displayed on the result page) or use print statements and look for output in the server log.
If the script fail for some reason, the exception message will be displayed in the result area, and a stack trace will be dumped in the logs.
To Learn about Groovy syntax, you can check out the official website

Access to JIRA

There is a number of JIRA Managers which are available to your groovy scripts as defined variables (link to javadoc provided): I also defined those variables in case they would be useful: Here is the first screenshot: