IntelliJ IDEA 2017.3 Help

Running and Debugging Groovy Scripts

Running Groovy scripts

In IntelliJ IDEA, you can run and debug Groovy scripts using the regular procedures:

Besides executing a Groovy script with the permanent run/debug configuration, you can use a temporary one, which is available at the context menu of a script:


Observe results in the Run and Debug tool windows. Note that in Groovy-enabled modules, the debugger is aware of the Groovy syntax, and enables handy evaluation of expressions.

Validating Groovy scripts located in resource directories

Starting with the IntelliJ IDEA version 2016.3 you can validate Groovy scripts that are located in resource roots.

  1. Select directories for which you want to start the build.
  2. On the main menu, select Build | Groovy Resources.
  3. In the drop-down list select Build Resources.
    IntelliJ IDEA starts the incremental build for the files located in the resource directories.
    Use Rebuild Resources for re-compiling. Note that all files in the project are compiled or recompiled excluding the ones that are specifically excluded from the Validation.

Evaluating Groovy expression

  1. Launch the debugger session, as described in the section Debugging.
  2. When you reach a breakpoint, where you want to evaluate expression, press Alt+F8.
  3. In the Code Fragment Evaluation dialog box, select Groovy from the Language drop-down list, type the desired expression, and click Evaluate:
Last modified: 6 March 2018

See Also