Basics Of Groovy Define Groovy Introduction to Groovy

Basics on Groovy Tutorials

Groovy is a scripting language for Java,thus enabling java based development faster than ever before.It runs on grails platform.Talking particularly about web development, groovyon grails cuts more than half of the development work as it creates all the controllers and views itself from the domain classes(model). So,in the nut shell when it comes to MVC pattern in java based web development,groovy is the cherry on the cake,as it cuts down more than half of the development work and it recoganizes all the java pre-existing APIs,thats correct we can use java code in groovy as good as groovy itself.

Following steps describe how to install a binary distribution of Groovy.

Atfirst, Download a binary distribution of Groovy and unpack it into some file on your local file systemset your GROOVY_HOME environment variable to the directory you unpacked the distribution add GROOVY_HOME/bin to your PATH environment variable

Set your JAVA_HOME environment variable to point to your JDK. On OS X this is /Library/Java/Home, on other unixes its often /usr/java etc. If you’ve already installed tools like Ant or Maven you’ve probably already done this step.

You should now have Groovy installed properly. You can test this by typing the following in a command shell:

groovysh
Which should create an interactive groovy shell where you can type Groovy statements. Or to run the Swing interactive console type:

groovyConsole
To run a specific Groovy script type:

Following steps describe how to install grails.

Download latest version of Grails.

Set the environment variable GRAIL_HOME to the home folder of Grails/bin,where you have dwnloaded it.

Set PATH env to GRAIL_HOME/bin

Installation can be checked with grails command line options.

Commands like

grails create-app project-name(Creates a new project)

grails create-domain-class(creates domain class from current working directory as the project folder)

grails generate-views(creates views from current working directory as the project folder)

grails run-app (Runs project)

Grails is an open source framework.It is very flexible and configurable.It lessens the burden of developer as it creates almost all basic codes for domain classes,controllers and views.It is a nice replacement to struts or JSF where all these need to be written from scratch.

This entry was posted
on Sunday, September 26th, 2010 at 8:56 am and is filed under Java.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.