See also the tutorial Getting Started with Grails to learn how to create web applications with Grails.

{redirect:https://www.jetbrains.com/idea/help/groovy.html|delay=0}

1. Enable the plugin

Before you create your first Groovy application make sure Groovy plugin is enabled in

{span:class=shortcut}Settings{span}
{span:class=shortcut}Plugins{span}
.

2. Create a new project

Open

{span:class=shortcut}Project Wizard{span}
and select Groovy template. Since Groovy requires Java you have to specify the
{span:class=shortcut}Project SDK{span}
.

If you create a Groovy project for the first time IntelliJ IDEA will offer you to create Groovy SDK library. Press

{span:class=shortcut}Create{span}
button and choose directory with a Groovy SDK.

The IDE will create an empty project.

3. Create a new class

The easiest way to create Groovy class or script is to use

{span:class=shortcut}Ctrl{span}
+
{span:class=shortcut}N{span}
shortcut from
{span:class=shortcut}Project View{span}
or
{span:class=shortcut}Navigation Bar{span}
.

Choose between class, interface, enum and annotation with

{span:class=shortcut}Up{span}
and
{span:class=shortcut}Down{span}
arrows.

Let's create a class with a method returning

{span:class=id}"Hello, world!"{span}
string.

4. Create a new script

Now we can create a script file via

{span:class=shortcut}Ctrl{span}
+
{span:class=shortcut}N{span}
shortcut.

Choose between script and GroovyDSL script with

{span:class=shortcut}Up{span}
and
{span:class=shortcut}Down{span}
arrows.

Now we can create an instance of our class and invoke

{span:class=id}hello{span}
method.

5. Run the project

In order to run the application you can manually create a Run configuration via

{span:class=shortcut}Run{span}
{span:class=shortcut}Edit configurations{span}
or run the active script automatically by pressing
{span:class=shortcut}Ctrl{span}
+
{span:class=shortcut}Shift{span}
+
{span:class=shortcut}F10{span}
shortcut.

See also the tutorial Getting Started with Grails to learn how to create web applications with Grails.