New Location

My website has moved to http://www.jasonwhaley.com. Please visit there for the latest and only remain here for legacy content.

Friday, March 6, 2009

Adding Environmental Variables to Netbeans

Short story - I loaded a fairly large multi-module maven project into my Netbeans 6.5 IDE and hit an OutOfMemoryException when running `mvn clean install` on the parent pom. Simply put, running all of the goals on this project requires more than that default 256m of max heap size that automatically gets allocated for maven. It is an easy fix when running mvn from your shell - just use:

`export MAVEN_OPTS=-Xmx512m`.

Unfortunately, the maven configuration in Netbeans doesn't allow you, through menus at least, to set this. In order to set environmental variables such as this, you'll need to add them to ~/.netbeans/6.5/etc/netbeans.conf. E.g.:

jwhaley@thirdeye:jwhaley$ cat ~/.netbeans/6.5/etc/netbeans.conf
export MAVEN_OPTS=-Xmx512m

2 comments:

Milos said...

in 6.7, it should be possible to set Env.FOO=bar in the project properties Actions panel and set the env var FOO for the given execution configuration.

Jason Whaley said...

I'll find out today since I'm upgrading to 6.7 M3 :)