So, you have some old Grails project, that for many reasons would be way too complicated to upgrade to the latest Grails version, but you still want to take the latest Grails version for a spin. And of course, you want to be able to call “grails” from the terminal, without having to type the exact path of each executable, grails-jurassic and grails-latest. No problems, here’s a nice little script that solves this problem, https://github.com/deluan/grails.sh.
The instructions are pretty clear, but just to make it easier for you, here are the steps:
- All the Grails installations should be under the same directory, i.e. /Users/me/
- The GRAILS_HOME environmental variable should point to the default Grails installation (this is the top directory of the installation, not the executable grails file). Yes, did I mention you can have a default Grails installation?
- Download the script from here, https://raw.github.com/deluan/grails.sh/master/grails
- Include the directory where the script is copied, to your PATH environmental variable.
- Exclude $GRAILS_HOME/bin from your PATH, so that instead of the Grails executable, the shell script you just downloaded gets executed.
- Hopefully, now, you should be able to run “grails” like before. By running “grails”, the default Grails version will be executed, alternatively, you can run grails version, for example grails 2.2.2. You can find the version on the name of the Grails directory.