Tag Archives: permgen

Maven Surefire PermGen error


In case you are getting PermGen error while running tests using the Maven Surefire plugin, here is the solution:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>${surefire.version}</version>
  <configuration>
    <argLine>-Xmx512m -XX:MaxPermSize=256m</argLine>
  </configuration>
</plugin>

Setting the JVM args as part of the plugin did the trick!

Setting MAVEN_OPTS would not help because Maven Surefire plugin forks the JVM process while running the tests, and so the MAVEN_OPTS settings do not take effect.