Testing Grails 2.0.0.M1 with MacPorts

Last week, Grails 2.0.0.M1 was released. If you're eager to test this new milestone release, but you don't want to upgrade all your apps yet, don't worry: there's an easy way to switch between Grails 1.3.7 and Grails 2.0.0.M1, at least on Mac OS X with MacPorts installed.

First, make sure you have Grails 1.3.7 installed:

sudo port install grails

Then, install Grails 2.0.0.M1:

sudo port install grails-devel

Finally, add this to ~/.bash_profile:

export GRAILS_HOME=/opt/local/share/java/grails

alias g13="sudo port deactivate grails-devel; sudo port activate grails @1.3.7_1"
alias g2="sudo port deactivate grails; sudo port activate grails-devel @2.0.0.M1_0"

Now switching between Grails versions is as simple as typing in g13 or g2 on the command line.