Groovy Macro

Last modified by Admin on 2024/06/10 00:14

cogAdds ability to write scripts in Groovy in wiki pages
Developed by

XWiki Development Team

Active Installs5
0 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Installable with the Extension Manager


This is a shortcut for Script Macro equivalent to {{script language="groovy"}} to execute groovy scripts.


def list = ["one", "two"]
list.each { item ->
  println "* ${item}"

Parameters definition

If Groovy script is not supposed to produce any output, for example, Groovy Class with just parameters is defined, declare  macro as:

{{groovy output="false"}}

See Script Macro for details.


def list = ["one", "two"]
list.each { item ->
  println "* ${item}"


  • one
  • two

Note that since context is a reserved binding in JSR-223 specifications used for Scripting Macros, the XWiki Api Context is now accessible throught xcontext

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.


Dependencies for this extension (org.xwiki.platform:xwiki-platform-rendering-macro-groovy 16.4.0):

Get Connected