Groovy templates

Groovy Template is a templating engine for JavaScript. It lets you insert dynamic content into any text through the use of templates. A template contains variables and/or expressions, which get replaced with values when a template is rendered. This is very similar to JSP markup. 

On this page:

Groovy templates in JMWE 

Groovy templates in JMWE are used in:

Groovy templating features

To output the result of a simple Groovy expression, write your Groovy code as <%= some Groovy code %>. For example:

For single-statement expressions, you can also use the following shortcut:

To simply execute a Groovy code and not output the result, write your Groovy code as <% some Groovy code %>. For example:

You can also output the value of a variable or its properties using $variable or $variable.someProperty. For example:

$currentUser returns an ApplicationUser

$ returns the username of the current user

To call a method on the variable, use ${variable.method()}:

${currentUser.getName()} also returns the username of the current user

Groovy template examples

Write the issue key as a comment to the issue:

Comment an issue based on the priority of the issue:

To send an Email to the Voters and Watchers of the issue when the issue is resolved, write this as the Subject of the Email (note that we mixed <%= %> and ${} expressions only to show how both are valid):

(info) Note that you can also "print" to the text: If you would like to print the components of the project: