Using Groovy to write Atlassian plugins

Writing plugins for Atlassian products is pretty straight forward (once you get passed the insanely out-of-date documentation). But using Java can be overly verbose and less flexible than some other more modern languages. There are examples of writing plugins using Scala and JRuby out there but documentation for using Groovy seems to be a bit of a black hole. Since Groovy is my JVM language of choice, I have decided to document the process and give a simple example.

Getting started

Before you start you need to make sure that you have installed the Atlassian SDK. Once you have that installed we can create a new JIRA plugin. These steps should work fine for RefApp plugins as well as Confluence.

Create a project

  • Run atlas-create-jira-plugin from the command line
    • groupId: rocks.stevegood.jira
    • artifactId: my-groovy-plugin
    • version: 1.0.0-SNAPSHOT
    • package: rocks.stevegood.jira
    • Y: y

Modify your pom.xml

Add the groovy-all dependency to your plugin


Add the GMavenPlus plugin to your plugins block


Update the instructions for the maven-jira-plugin plugin




Add the groovy.version property to the properties block


Update your project structure

  1. Rename src/main/java to src/main/groovy
  2. Rename src/test/java to src/test/groovy
  3. Rename all *.java files to *.groovy
  4. Fix the MyPluginComponentImpl.groovy file (around line 11) so that it compiles
    • Change @ExportAsService({MyPluginComponent.class}) to @ExportAsService([MyPluginComponent])

Clean up code and run the plugin

You can now go through your files are remove things like semicolons, parenthesis, and public scope declarations. At this point you should be able to start your plugin with atlas-run. If it doesn’t work, verify that you have made all of the changes listed above and try again. You might also try cleaning your project first to avoid lingering artifacts with atlas-clean. You can also checkout the example source code if you get stuck.

Once you have JIRA running you should be able to see that your plugin has loaded from the Manage Addons screen. You should see something similar to the this:


Steve Good

Professional software engineer, amatuer photographer, and part-time mountain biker.