Brian F Love
Learn from a Google Developer Expert focused on Angular, Web Technologies, and Node.js from Portland, OR.
Ad·ultimatecourses.com
Learn Angular the right way with Ultimate Courses

Increase Java Heap for Maven Build

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 F 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 Portland and I ski (a lot).