Grails multi-version launch script
Note: The latest version of the script below is on github.
I work with grails quite a lot these days. I have about 5 plugins and over 10 projects that I currently work on frequently. Fairly inevitably they use an assortment of grails versions. Manually chopping and changing command lines to execute different versions gets pretty tedious.
The solution - have a grails wrapper script that detects the version of grails defined in the current project and runs the right one.
This wasn't my idea, but when I finally got fed up with manually juggling grails versions I couldn't find where I had read about it previously. So I decided to write my own version.
This relies on putting all of the grails releases that you want to support into /usr/local/grails/ using the directory names that come in the distribution file (ie grails-x.x.x). Then just create /usr/local/bin/grails with the following content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
In existing projects you can just run "grails" and it will pick the right version - assuming you have it installed. If you want to override the automatic choice (eg when upgrading the project) you can specify a version as the first parameter:
grails 1.3.7 upgrade
Likewise when not in a project (eg when creating a new one) you can do the same thing:
grails 1.3.5 create-app