Previously i have talked about setting Java Heap Memory in Maven.
But i find that the OutOfMemoryError still exists when running the JUnit test during build. =.=
After searching in Google, i realize that in Maven…
JUnit tests ignore the environment variable MAVEN_OPTS and the JVM settings in Run Configurations.
So if u have OutOfMemoryError when running unit test in Maven, you have to set the Java Heap Memory in the maven-surefire-plugin inside the pom.xml.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.5</version> <configuration> <argLine>-Xms512m -Xmx512m</argLine> </configuration> </plugin>
Done =)
Reference:
Pingback: Maven Surefire Plugin – out of memory – verhindern | Analysisfreaks.de
Thanks for pointing out this option!
I’ve had to profile the memory consumption with jconsole of my mvn test build to realize that JUnit isn’t picking up its memory settings from MAVEN_OPTS.
Good to know that i could help. =)
Thanks for the clarification and the pom sample.
You are welcome and thanks for your comment. =D