If you like my posts, like my Facebook page please :)

Links

For most beginners, one of the hardest part in learning a new technology, is to setup their development environment. This tutorial is written to help new Grails programmers to prepare their Windows Development Environment.

Install JDK

Since Grails runs on top of the Java platform, having the Java Development Kit (JDK) in your system is a requirement. For better compatability, I recommend using the JDK version 1.6. As of the time of this writing, JDK 1.7 is already available, but have some minor issues with Grails.
Go to Oracle website and download the JDK installer file. (http://www.oracle.com/technetwork/java/javase/downloads/jdk6u38-downloads-1877406.html)

Just run and follow instructions

Install Grails

Go to Grails website and download the latest version of Grails. (http://grails.org)
And just extract it in your C drive:

Setup Environment Variables

You need to setup your environmet variables. You need to specify the JAVA_HOME, GRAILS_HOME, and the path to their executable programs.

JAVA_HOME - is the directory where you installed the JDK. For example: C:\Program Files\Java\jdk1.6.0_38

GRAILS_HOME - is the directory where you extracted Grails. For example: C:\grails-2.2.3

PATH - Append the executable (bin) directories to the end of the previous value. For example: %PATH%;C:\Program Files\Java\jdk1.6.0_38\bin;C:\grails-2.2.3\bin

You can test if everything is fine by going to command line and issue "javac -version" and "grails -version" command:

Install Groovy/Grails Tool Suite

This step is optional, as you can use just notepad and command line to develop Grails applications. But having an IDE is very convenient. One of the most used free IDE for Grails developmet is Groovy/Grails Tool Suite. Just go to the website and download. (http://www.springsource.org/downloads/sts-ggts)

And extract to your C drive:
Now you can run the program. For example run C:\springsource\ggts-3.3.0.RELEASE\GGTS.exe:
And it should look like this:

Configure Groovy/Grails Tool Suite

We have to make sure that the Java run time of our IDE points to a JDK instead of a JRE. Here are the steps:
Go to Preferences:
Edit Installed JRE if it is pointing to a JRE installation:
Change it to the JDK installation directory installed in the steps above. It is better if you also change the Name:
Make sure you have an installed Grails SDK:

Create and Run a Sample Application

To validate that everything is properly working, we will create a sample project and run it.
From the File Menu, create a new Grails Project:
Give it a name (e.g. sample) and click finish:
The project will be created with default skeleton directories and files.
Open Grails Console:
Type "run-app" and hit the Enter key
Check the console and wait for the message "Server running".
Now you can open the application in your browser to test:
As you can see, by default the skeleton program have a working screen. Complete with styles and some logic. I will add more tutorials on how to use Grails in the future.

Recommended IDE - IntelliJ IDEA

I have been using Grails since 2007 and have implemented multiple projects with it. I initially did not believe that IDE matters with productivity and I just used Open Source IDE. Out of curiosity, I acquired an IntelliJ IDEA license back in December 2012 and never looked back. I now believe that this is head and shoulders above other IDE's for Java and Grails development. Here are some of the features I like:

It understands the structure of a Grails project.

Autocomplete in Groovy code

It has autocomplete feature for domains, services and others.
Even dynamic methods are supported

Objects Passed by Controllers to Views

When objects are passed to views to be used for rendering:
The autocomplete is available for those objects. IntelliJ knows the names of the objects and has autocomplete features for their methods and properties.

CSS

The IDE knows which CSS were included to your layout and provides autocomplete for it:

Custom Tags

If you create a custom tag, the IDE supports autocomplete for it

Version Control Support

Out of the box, IntelliJ supports many of the popular version control system. This is a big time saver because other IDE's takes time to configure VCS and you would usually run into plugin incompatibilities.

These examples are just the tip of the features targetted for the Grails framework. Adding up all the conveniences easily makes me at least 50% more productive. I highly recommend this IDE for all who wants to be serious with Grails programming. To know more about IntelliJ, you may visit their website here.