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, groovy on 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.

  1. 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
  2. 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.
  3. You should now have Groovy installed properly. You can test this by typing the following in a command shell:

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

To run a specific Groovy script type:

Following steps describe how to install grails.

  1. Download latest version of Grails.
  2. Set the environment variable GRAIL_HOME to the home folder of Grails/bin,where you have dwnloaded it.
  3. Set PATH env to GRAIL_HOME/bin

Installation can be checked with grails command line options.

Commands like

  1. grails create-app project-name(Creates a new project)
  2. grails create-domain-class(creates domain class from current working directory as the project folder)
  3. grails generate-views(creates views from current working directory as the project folder)
  4. 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.

Number of View :5186


  1. No comments yet.

Content Protected Using Blog Protector By: PcDrome.