maven-surefire-plugin only uses 67MB of heap?

Today i  had to do some merging of artifacts (code and pom.xml). Then i wondered, why the tests didn’t run properly.

java.lang.OutOfMemoryError: Java heap space” was the reason. But why? I didn’t change the tests and i carefully merged the configuration. So i connected VisualVM to the surefire process and saw that only ca. 67MB max heap were available. I reviewed my MAVEN_OPTS, but my settings didn’t apply…

The culprit is a bug. See http://jira.codehaus.org/browse/SUREFIRE-501.

The workaround is to place your max heap configuration in the configuration section of the plugin. As seen in the linked bug issue:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <configuration>
    <!-- http://jira.codehaus.org/browse/SUREFIRE-501 -->
    <argLine>-Xmx256m</argLine>
  </configuration>
</plugin>
Advertisements

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 )

Google+ photo

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

Connecting to %s