How to increase JVM heap size for Maven —15 May 2012
Do not edit mvn (or mvn.bat) itself. Add any necessary JVM arguments to the MAVEN_OPTS environment variable.
Depending on your environment, increasing the max heap may not be enough, you might get a different kind of OOM:
java.lang.OutOfMemoryError: PermGen space
The “PermGen space” is for storing information about the heap itself. The bigger the heap, the PermGen space also needs to be bigger, you can increase both like this: