My Adventures in Coding

June 15, 2009

mvn clean install – Could not reserve enough space for object heap

Filed under: Maven — Brian @ 5:20 pm

If you get the following error, it is most likely that the “Surefire” pluggin does not have enough memory.

Error occurred during initialization of VM
Could not create the Java virtual machine.
Could not reserve enough space for object heap
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.

The solution is to increase the memory for the Surefire pluggin using the command line option:

mvn -Dsurefire.memory="-Xmx512m" clean install


June 12, 2009

mvn deploy – java.lang.OutOfMemoryError

Filed under: Maven — Brian @ 12:48 pm
Tags: ,

If you are doing a mvn deploy and get the following error:

[INFO] ------------------------------------------------------------------------
[INFO] Java heap space
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.OutOfMemoryError: Java heap space

The problem is most likely that Maven has run out of memory. By default maven sets a maximum memory size of 64mbs. When deploying a large file such as a 15mb+ jar file it can easily run out of memory.

The simple but not so obvious solution is to tell maven to set the max memory size in the MAVEN_OPTS environment variable:


Now execute your deploy again and it should work fine!

Create a free website or blog at