IntelliJ IDEA 13.1.0 Web Help

With IntelliJ IDEA, it is possible to launch a Groovy console for Java projects and Grails application, and use it as a "scratch-pad" for evaluating some code snippets, without starting the debugger session.

In this section:

To launch Groovy console
  1. On the main menu, choose Tools | Groovy Console.
  2. If your project consists of two modules or more, choose the module to use the classpath of:

    Groovy_Module_Console

    The Groovy console starts in a separate tab of the Run tool window:

To use Groovy interactive console
  • Type code in the console after the prompt character, or just paste from the editor tab.

    Note that coding assistance is available, as you type (code completion and error highlighting):

    groovyConsoleCodeAssistance

  • Click runBuild, or press Ctrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCtrl+EnterCommand EnterCommand EnterCommand Enter to execute the entered code.
  • To start a new line, press EnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnter.
  • Use up and down arrow keys to navigate through the history of commands. Depth of the history is defined by the Console commands history size in the Editor settings.
  • Use the basic and advanced editor shortcuts. In particular, you can jump to declaration of a symbol, if you place the caret at the symbol name, and press Ctrl+B, Ctrl+Button1 Click or Button2 ClickCtrl+B, Ctrl+Button1 Click or Button2 ClickCtrl+B, Ctrl+Button1 Click or Button2 ClickCtrl+B, Ctrl+Button1 Click or Button2 ClickCtrl+Alt+G, Escape, Period, Alt+Period or Ctrl+Button1 ClickCtrl+B, Ctrl+Button1 Click or Button2 ClickF12, Shift+F2, Ctrl+B, Ctrl+Button1 Click or Button2 ClickCtrl+B, Ctrl+Button1 Click or Button2 ClickF3 or Ctrl+Button1 ClickCommand B, Command Button1 Click or Button2 ClickCommand B, Command Button1 Click or Button2 ClickF3 or Control Button1 Click. Alternatively, keep the Ctrl key pressed, and hover your mouse pointer over the reference to a symbol. So doing, brief information appears at the tooltip, and the reference turns to a hyperlink, which allows you to jump to the declaration in the source code.

See Also

Concepts:

Web Resources: