Abhishek
Abhishek

Reputation: 783

Maven build on Eclipse: java.lang.OutOfMemoryError: Java heap space

I know this has been asked multiple times before, but no solution worked so far in my case.

Situation: I'm trying to build a Maven project. The environment is JDK 1.7 on Eclipse.

Problem: Upon running a Maven build, I get the following error:

java.lang.OutOfMemoryError: Java heap space

What I've tried : In my pom.xml I tried from other StackOverFlow answers:

                        <fork>true</fork>
                        <meminitial>512m</meminitial>
                        <maxmem>1048m</maxmem>
                        <verbose>true</verbose>
                        <argLine>-Xmx1024m</argLine>

I also changed the memory settings in eclipse.ini

Any help will be greatly appreciated.

Upvotes: 0

Views: 2374

Answers (2)

Abhishek
Abhishek

Reputation: 783

@tagellei gave the correct answer (in the comments section). Thanks @tagellei

Right-click on the project --> Run As --> Run Configurations --> Click the JRE Tab on the pop-up window --> Under VM arguments, type: -Xms512M -Xmx1024M

Upvotes: 1

Jayanga Dissanayake
Jayanga Dissanayake

Reputation: 76

If you are trying this on a Linux machine, set MAVEN_OPTS as below and see.

export MAVEN_OPTS="-Xms1024m -Xmx4096m -XX:PermSize=1024m"

Upvotes: 2

Related Questions