[Tutorial] Groovy and Grails Part 2 – Installing Grails

This is the next article from Grovvy and Grails Part 1 – Introduction that you can read it here. Now we continue to install grails in your machine. Before you continue, there are some requirements to run Grails in your machine, so please read it carefully 🙂

Requirements to install Grails:

  1. Java SDK 1.4 or higher and have set your JAVA_HOME variable to the SDK install location. note here, Java OpenSDK and JRE is not working with Grails.
  2. Apache Ant 1.6.5 or higher *
  3. JUnit (to run the build tests – put junit.jar in your ANT_HOMElib directory) *
  4. Subversion client *

Note: * , if you planning to install grails from SVN, to keep your installation uptodate

Steps to install Grails from binary release:

  1. Download grails binary Zip or Tar/Gz
  2. Extract to any location in your drive, usually in C:grails (on windows) , ~/grails (on Linux)
  3. Create a GRAILS_HOME environment variable that points to the path where you extracted the archive (eg C:grails on Windows or ~/grails on Unix)
  4. Check if JAVA_HOME already set in environment variable, if not set it now.
  5. Append a reference to the “bin” directory within the Grails directory to your PATH variable (eg %GRAILS_HOME%bin on Windows or $GRAILS_HOME/bin on Unix)
  6. Type “grails” at the command line, if a help message is displayed you are ready
  7. On Linux, if you get an error message, try to chmod +x the grails script inside the bin directory.

Steps to install Grails from source or subversion:

  1. Download Grails binary Zip or Tar/Gz or checkout from subversion with this command:
    svn co http://svn.codehaus.org/grails/trunk/grails/
  2. Set the JAVA_HOME environment variable
  3. Set the GRAILS_HOME environment variable to your Grails extract or checkout folder
  4. Add the “%GRAILS_HOME%bin” directory to your PATH environment variable
  5. Add the “%GRAILS_HOME%antbin directory to your PATH environment variable.
  6. Run chmod +x in “%GRAILS_HOME%antbin
  7. Go to the %GRAILS_HOME% directory and type “ant” to build Grails
  8. Wait until it finish compiled, and you are ready to use Grails

Note: To update subversion folder, you can use this command: svn up , and every update you need to run recompile Grails again (refer to step 7).

Next article: Groovy and Grails Part 2 – Create a Web Application

Comments

  1. this was a nice tutorial , i was looking for this kind of tutorials because i didnt know how to install Grails

    Thanks

Give me your feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.