Wednesday, June 1, 2011

GRAILS Getting Started

I have been working in GRAILS for more than a year and was very much impressed with the simplicity and power of this framework. It's a JAVA/J2EE framework which is based on GROOVY and SPRING SOURCE. The framework follows a convention over configuration design. In short, it helps me to get rid of loads and loads of xml configuration.


Installing GRAILS should be a piece of cake for any java developer. Infact you can even install grails and groovy directly from your eclipse spring tool suite. Anyways its up to you but I rather like the console version for commands.


This is basically the first step of GRAILS. This can be done directly from console or from your Spring Tool Suite Dashboard.

Once Grails support is installed for your spring tool suite, you will get an option of creating a new grails project from the STS dashboard. 

This is the console command for creating a new web project or app. 

Beware : The console command will create your new project in the current working directory whereas the STS will create it in your workspace.


Once an app is created, GRAILS will create quite a lot of folders for you.
I created an app called LetsGrail. Below is the complete folder structure of the app.

Folder structure of grails within STS

I believe all the folder names are self explanatory so I will leave it for you to figure out. In addition to this GRAILS will also create folders called .grails and .ivy2 in your Users folder. For me its here C:\Users\Lalit\. We will discuss more about both the folders when we go deep into grails.


In my next post, I will explain about the database connection in GRAILS and basic configurations.