Skip to end of metadata
Go to start of metadata
See also the tutorial Getting Started with Grails to learn how to create web applications with Grails.

1. Enable the plugin

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

2. Create a new project

Open Project Wizard and select Scala template. Since Groovy requires Java you have to specify the Project SDK.

If you create a Groovy project for the first time IntelliJ IDEA will offer you to create Groovy SDK library. Press Create 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 Ctrl + N shortcut from Project View or Navigation Bar.

Choose between class, interface, enum and annotation with Up and Down arrows.

Let's create a class with a method returning "Hello, world!" string.

4. Create a new script

Now we can create a script file via Ctrl + N shortcut.

Choose between script and GroovyDSL script with Up and Down arrows.

Now we can create an instance of our class and invoke hello method.

5. Run the project

In order to run the application you can manually create a Run configuration via RunEdit configurations or run the active script automatically by pressing Ctrl + Shift + F10 shortcut.

See also the tutorial Getting Started with Grails to learn how to create web applications with Grails.
Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Dec 02, 2014

    Anonymous

    > Open Project Wizard and select Scala template.

    'Scala' should be Groovy?

    1. Feb 10, 2015

      Anonymous

      Same what I thought.

      1. Feb 24, 2015

        Anonymous

        What a dumbass.

  2. Apr 27, 2015

    Anonymous

    Probably just copy & paste

  3. May 06, 2015

    Anonymous

    That was just an isolated error. Every publication has a mishap, which is usually fixed in a separate document called 'errata'.

    In this case, You can see by the context they're talking about 'groovy', not 'scala'.

    Thanks to the IntelliJ Idea staff for the excellent documentation.

Add Comment