Today I've faced a serious problem: branchy development in Grails. Sounds easy, right? Well... Let's examine this a little bit.
Grails store files in 4 different locations:
- The folder where you've unzipped the distro (GRAILS_HOME)
- The project's folder
- The project's "target" folder
- User's home/.grails/{version} folder
As usually with Grails there's an ultra-easy way of fixing this problem :) Here's the content of my grails.bat that does the trick:
@echo off
set GRAILS_HOME=C:/grails-1.3.4
set JAVA_OPTS=%JAVA_OPTS% -Divy.cache.dir=%CD%/target/libraries
set JAVA_OPTS=%JAVA_OPTS% -Dgrails.project.work.dir=target/work
%GRAILS_HOME%\bin\grails.bat %*
As you can see here everything is made project-specific. In "target/libraries" is the ivy cache (instead of home/.ivy2 which causes problems from time to time when working with other technologies such as JSF) and in "target/work" are the project's artifacts.
And live is gooooooooood again :)