Thomas Sundberg

October 14, 2011

Maven Java heap space

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

About these ads

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Customized Silver is the New Black. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 41 other followers

%d bloggers like this: