Last updated by 3 years ago

Page: Installation, Version:50

Installation from Download

Prerequisites

Before you can start using Grails you will need to install a Java SDK (not just a JRE) and set the JAVA_HOME environment variable to the location of that SDK. The minimum required version of the SDK depends on which version of Grails you are using:

  • Java SDK 1.4+ for Grails 1.0.x and 1.1.x
  • Java SDK 1.5+ for Grails 1.2 or greater

Steps

  • Download the latest Grails release
  • Extract the archive into an appropriate location; typically C:\grails on Windows or ~/grails on Unix
  • 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)
  • If you have not set the JAVA_HOME environment variable yet, create JAVA_HOME environment variable that points to the path where you have installed Java
  • 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). Note that, for Windows, both PATH and GRAILS_HOME must be defined at the same environment variable level (eg. 'System variables') rather than across environment variable levels (eg. PATH under 'System variables' and GRAILS_HOME under 'User variables')
  • Type "grails" at the command line, if a help message is displayed you are ready to start using Grails!
  • If you get an error message, try to chmod +x the grails script inside the bin directory.

Installation from Git (The Version Control Repository)

Prerequisites

In order to start using Grails from Git you need to have the following:

  • An installation of Java 1.5 or higher and have set your JAVA_HOME variable to the install location
  • A Git client

Steps

  • Check out Grails from the Git repository
    • by running: git clone git://github.com/grails/grails-core.git
  • Set the GRAILS_HOME environment variable to CHECKOUT_LOCATION/grails-core
  • Add the $GRAILS_HOME/bin directory to your PATH environment variable
What happens next depends on which branch you are working on.

For the 1.3.x, 1.4.x and the 'master' branch:

  • Go to the GRAILS_HOME directory and run: ./gradlew libs
  • Then from the GRAILS_HOME directory run: ./gradlew install
  • That's it! You can now start developing in Grails using your custom copy of Grails!

For the 1.2.x branch:

  • If you don't have Ant 1.7 (or later) installed, you will need to
    • set ANT_HOME to $GRAILS_HOME/ant
    • add $ANT_HOME/bin to your PATH environment variable
    • you may need to give the scripts in $ANT_HOME/bin execute permissions
  • Increase the java memory to 1024M by setting ANT_OPTS=-Xmx1024M
  • Go to the GRAILS_HOME directory and type ant jar to build Grails
  • That's it! You can now start developing in Grails using your custom copy of Grails!

Other Languages