grails build via run configuration doesn't honor grails.work.dir

We've gone to some lengths to try to encapsulate our development environment within a single root folder to avoid interfering between various projects with different development environments.  One of the steps we've taken is to force all the working folders that get generated under c:\documents and settings\... to stay within our local root folder.  One such folder is the .grails working directory.

We launch IDEA (8.1.3) from an environment in which we've overriden the USERPROFILE and HOMEPATH environment variables and set additional environment settings (including grails.work.dir) as shown below:

SET USERPROFILE=C:\dev-env\settings\userprofile
SET HOMEPATH=\dev-env\settings\userprofile
SET JAVA_OPTS=-server -Xms128m -Xmx512m -Xmn64m -XX:PermSize=64m -XX:MaxPermSize=128m -Dgrails.work.dir=%USERPROFILE%\.grails
SET ANT_OPTS=-Xms128m -Xmx512m -Duser.home=%USERPROFILE%


When I run the grails test-app target via IDEA's 'Tools->Run Grails Target' menu option, this works fine.  The .grails folder is created in the path we expect. However, when we run the test-app target via 'Run/Debug Configurations', it doesn't honor these settings and ends up creating the .grails folder in the default, 'documents and settings' path.

I don't understand why these behave differently, and I can't figure out how to make the Run/Debug Configurations behave the same as Run Grails Target. Can anyone offer any suggestions here?  Is this a bug?

Thanks.
5 comments
Comment actions Permalink

Yes, it's a bug. Could you file a JIRA issue?

0
Comment actions Permalink

Bug or not, it seems like IDEA must be getting the 'Documents and Settings' path from somewhere when it runs tasks via 'Run/Debug Configurations'.  If I could find out where it is getting that (environment variable? config file?), I might at least be able to work around this.

0
Comment actions Permalink

Unfortunately, it's a core user.home environment variable, and you can't
change it easily in Grails integration only.

0
Comment actions Permalink

I'm not concerned about having the setting apply to all of IDEA instead of just the grails integration.  In fact, that's what I'm trying to achieve--I want all the generated files going into a directory within my 'dev-env' tree structure instead of dropping files under Documents and Settings.

I was already setting USERPROFILE and HOMEPATH environment variables to try to force this for various tools.  Based on your response, I've now added a USER.HOME environment variable, and I've added -Dgrails.work.dir=${user.home}/.grails to the VM Parameters for my run configuration.

With those changes, it seems to be working the way I want.  Thanks for the help on this.

0

Please sign in to leave a comment.