Groovy tutorial

Before you begin:

  • You need to install the JMWE add-on in your Jira Server instance
  • Some hands-on experience in Java or any other OOP language is helpful

By the end of this tutorial, you will be able to write simple Groovy scripts in JMWE.

Introduction to Groovy

Groovy is an object-oriented programming language for the Java platform. It is a dynamic language with features similar to those of PythonRubyPerl, and Smalltalk. It is easy to learn, has smooth Java integration, vibrant and rich ecosystem and powerful features. It brings the attractive benefits of dynamic languages to a robust and well-supported platform.

  • Seamless integration with Java - Groovy is friendly with the Java Runtime Environment and its syntax is aligned with Java
  • Feature-rich languageGroovy has three main enhancements over and above those of Java: language features, libraries specific to Groovy, and additions to the existing Java standard classes (known as the Groovy Development Kit, or GDK)

Tools to write Groovy scripts

You can use any IDE like IntelliJ IDEA or Eclipse or NetBeans to write your Groovy scripts and then copy them into JMWE workflow extensions. 

Starting with version 5.0.0, the JMWE add-on provides an integrated editor and tester that lets you write and test scripts. You can write your Groovy script in any of the workflow extensions that support a Groovy editor or in the Groovy script tester provided on the admin screen.

To write your script in the Groovy script tester on the admin screen:

  1. Log in to your JIRA Server instance as an administrator.
  2. Go to the Administration icon  and click on it.
  3. Locate Add-ons from the menu and click on it.
  4. Locate JIRA MISC WORKFLOW EXTENSIONS on the left panel.
  5. Locate Groovy script tester

The Groovy script tester is displayed. You can write your scripts and test them against an issue. The Groovy editor in JMWE has:

  • On-the-fly syntax checking - to provide information about syntax errors in your script
  • Automatic indentation of the code - for easy understanding of the code
  • An online help system that helps you write Groovy code quickly

See here for more information on the Groovy editor and tester.

Start learning

To start learning about the Groovy language, click here. If you are already familiar with the Groovy language but would like to learn more about how to use it in JMWE, click here.