Brian Love
Angular + TypeScript Developer in Denver, CO

Increase Java Heap for Maven Build

Reading time ~1 minute

If you have ever run into an issue with the Java Heap space when doing a Maven build, you can easily give more memory to Java. The error message from Maven will look like:

UNEXPECTED TOP-LEVEL ERROR:
 java.lang.OutOfMemoryError: Java heap space

The fix

I am on a mac, so it’s as simple as modifying the ~/.bash_profile file, adding the following two lines:

export MAVEN_OPTS="-Xmx2048m"
export _JAVA_OPTIONS="-Xms1024m -Xmx1024m -XX:MaxPermSize=512m"

Brian Love

Hi, I'm Brian. I am interested in TypeScript, Angular and Node.js. I'm married to my best friend Bonnie, I live in Denver and I ski (a lot).