Maven – How to set Java Heap Memory

You may encounter the error java.lang.OutOfMemoryError: Java heap space when running Maven. You can set the heap memory by setting the MAVEN_OPTS environmental variable.

For Linux:

  • export MAVEN_OPTS=-Xmx512m

For Windows:

  • set MAVEN_OPTS=-Xmx512m

Done =)

Reference: QuickTip : How to increase the Java heap memory for Maven 2 on linux

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.