Getting Started with Groovy
IntelliJ IDEA lets you create and run Groovy applications.
Before you start working with Groovy, make sure that the Groovy plugin is enabled in IntelliJ IDEA.
- Creating a Groovy Project
- Adding Frameworks to Existing Groovy Project
- Creating Groovy Class
- Creating Groovy Script
- Running Groovy Application
Creating a Groovy Project
- Open Project Wizard, in the left-hand pane select Groovy.
- In the right-hand pane, specify the following settings:
- Click Next.
- Specify your project information and click Finish.
Adding Frameworks to Existing Groovy Project
- In the Project tool window, right-click the project directory and from the drop-down list select .
- In the Add Frameworks Support dialog, select a framework and click OK.
Creating Groovy Class
- Press Ctrl+N or in the Project tool window right-click on the directory and select
- In the New Groovy Class dialog, in the Name field, specify a name of the class. In the Kind field, choose between class, interface, trait, enum or annotation.
- Now you can enter your code.
Creating Groovy Script
- Press Ctrl+N or in the Project tool window right-click on the directory and select .
- In the dialog that opens, in the Name field, enter the name of your Groovy script. In the Kind field, choose between Groovy script and GroovyDSL script.
- IntelliJ IDEA creates a file with the specified name and
groovyextension, and adds a node to the module tree view.
Running Groovy Application
- Create a Run configuration using or run the active script automatically by pressing Ctrl+Shift+F10.
- View the result in the Run tool window.
Last modified: 18 July 2017