(Quick Reference)

2.2 下载安装Grails - Reference Documentation

Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith

Version: null

2.2 下载安装Grails

The first step to getting up and running with Grails is to install the distribution. To do so follow these steps:
  • Download a binary distribution of Grails and extract the resulting zip file to a location of your choice
  • Set the GRAILS_HOME environment variable to the location where you extracted the zip
    • On Unix/Linux based systems this is typically a matter of adding something like the following export GRAILS_HOME=/path/to/grails to your profile
    • On Windows this is typically a matter of setting an environment variable under My Computer/Advanced/Environment Variables
  • Then add the bin directory to your PATH variable:
    • On Unix/Linux based systems this can be done by adding export PATH="$PATH:$GRAILS_HOME/bin" to your profile
    • On Windows this is done by modifying the Path environment variable under My Computer/Advanced/Environment Variables

If Grails is working correctly you should now be able to type grails -version in the terminal window and see output similar to this:


Grails version: 2.0.0

首先需要下载Grails的发行包并进行安装,执行步骤如下:

  • 下载 Grails二进制发行包并解压到指定的文件目录下
  • 在环境变量中添加GRAILS_HOME,值为上一步解压的文件目录。
    • Unix/Linux系统中,通常将export GRAILS_HOME=/path/to/grails追加到到用户的启动配置文件中(通常是.profile或者.bashrc等-译者注)
    • Windows系统上右击“我的电脑”/“属性”/“高级”/“环境变量”,点击新建。
  • 将GRAILS_HOME的bin目录追加到系统的PATH变量中:
    • Unix/Linux系统中,通常将export PATH="$PATH:$GRAILS_HOME/bin"追加到到用户的启动配置文件中(同上)
    • Windows系统上右击“我的电脑”/“属性”/“高级”/“环境变量”,修改PATH变量的值。

如果环境变量设置无误,此时可以打开终端(window下为命令提示符,Unix/Linux下为Shell),输入 grails -version 如果屏幕上显示如下提示则说明安装成功:


Grails version: 2.0.0