We've been using Grails for a little while now and have been through a few Grails versions now. We don't always want to migrate our 'older' apps immediately but often use a newer version for new development. Changing the Windows environment variables is inconvenient since I sometimes have to work on two related projects at the same time that are running different versions of Grails.
In Linux, I'd probably create wrapper scripts or aliases to allow me to specify on the command line a version switch but I don't believe Grails supports this.
How are others that need to code against multiple versions of Grails managing it?
Update:
I created a gv.bat file to set the GRAILS\_HOME
and PATH
environment variables. I added a GRAILS\_INSTALLS
environment variable (c:\usr\local\grails
on my box) and removed the %GRAILS_HOME%\bin
reference from my PATH
.
gv.bat
@echo off
SET GRAILS_HOME=%GRAILS_INSTALLS%\grails-%1
SET PATH=%GRAILS_HOME%\bin;%PATH%
To do any Grails work I run > gv 1.1.2 or whatever version I need to work with. I'd like to figure out how to do a string replace in the PATH
to change the value but that turned out to be difficult for me
Download the latest Grails releasePATH under 'System variables' and GRAILS_HOME under 'User variables') Type "grails" at the command line, if a help message is displayed you are ready to start using Grails! If you get an error message, try to chmod +x the grails script inside the bin directory.
Before installing grails, make sure that Java SDK 1.4 or higher is installed on your machine. In a nutshell, the environmental variables should be like.. JAVA_HOME = C:\Program Files\Java\jdk-1.5 GRAILS_HOME = C:\grails PATH = %GRAILS_HOME%\bin;%JAVA_HOME%\bin; This works fine for me.
I have a couple of bat files which changes the GRAILS_HOME and the system PATH according to which version I'm using.
It's not the most beautifull solution at all, but at least works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With