Maven Java heap space

Filed under: Automation, Java, Maven, — Tags: Java heap space, java.lang.OutOfMemoryError, maven-failsafe-plugin, maven-surefire-plugin — Thomas Sundberg — 2011-10-14

I just had test in a Maven build fail with

java.lang.OutOfMemoryError: Java heap space

It turns out that when Maven fork a new process to run the tests in, it doesn't seem to honor your MAVEN_OPTS settings and pass them to the new process. The solution may be to set the heap size for the Surefire, and possible Failsafe, plugin. This can be done with the optional argLine parameter.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.10</version>
    <configuration>
        <argLine>-Xmx1024m</argLine>
    </configuration>
</plugin>

This solved my urgent problem, getting the build to pass. My long term problem is now to understand why the test need more memory then before.

Resources



(less...)

Pages

About
Events
Why

Categories

Agile
Automation
BDD
Clean code
Continuous delivery
Continuous deployment
Continuous integration
Cucumber
Culture
Design
DevOps
Executable specification
Git
Gradle
Guice
J2EE
JUnit
Java
Javascript
Kubernetes
Linux
Load testing
Maven
Mockito
New developers
Pair programming
PicoContainer
Presentation
Programming
Public speaking
Quality
React
Recruiting
Requirements
Scala
Selenium
Software craftsmanship
Software development
Spring
TDD
Teaching
Technical debt
Test automation
Tools
Web
Windows
eXtreme Programming

Authors

Thomas Sundberg
Adrian Bolboaca

Archives

Meta

rss RSS