Update: Just use GVM. https://github.com/gvmtool/gvm
I’m currently working on a half dozen different projects in the Grails space and managing multiple Grails versions was becoming really painful.
For historical reasons 1 project is back in 1.2 land, for production stability the majority of projects are against 1.3 and my newest project is against the latest 1.4M1 release. So based on what some other folks have done around the web and mixing in my own tinkering the following has proven really useful in my .bashrc:
# GRAILS HELPERS
GRAILS_HOST=172.16.97.130
GRAILS=~/Development/grails
function setGrailsVersion {
rm -f $GRAILS/current
ln -s $GRAILS/grails-$1 $GRAILS/current
}
export JAVA_HOME='/usr/lib/jvm/java-6-openjdk'
export JAVA_OPTS='-server -Xms256m -Xmx512m -XX:MaxPermSize=128m'
export GRAILS_HOME=$GRAILS/current
alias gver=setGrailsVersion
alias grun='grails -Dserver.host=$GRAILS_HOST run-app'
PATH=$GRAILS_HOME/bin:$PATH
Now with a simple `gver 1.3.7` or `gver 1.4.0.M1` I can easily switch between Grails releases for the specific project I’m working on at any given time.
In addition `grun` ensures Tomcat binds to the public IP of my development machine, allowing testing of UI components across multiple client OS/browsers.
Simplistic for sure but proving to be a real time saver.
Maybe you will find it useful – I have published a scrip that resolves Grails version to use automatically based on application.properties.
See it here http://www.componentix.com/blog/16
Hi there, I’ve had a similar issue with Grails and multiple branches of the same application which if you look at it from a different Grails version point of view is pretty much the same issue. The project is called exactly the same but needs to run under different settings (plugin version is different for example).
It was a major headache for me for a couple of days and what I finally came up with was a solution similar to what Maven is doing: I’ve decided to change the standard folder in which applications store their build artifacts into a subfolder in “target”.
To add to this I’ve make several shell scripts, all looking exactly the same but targeting different versions of Grails. And so I have grails-1.3.5.bat, grails-1.3.7.bat and grails.bat that targets the current production release (which at this point is 1.3.7).
You can take a look at the solution here:
http://padcom13.blogspot.com/2010/09/same-name-different-projects.html
Best regards,
Matthias.