Out of Memory Error When Compiling a Project Via Maven

Yesterday I was seeing intermittent build failures for a Maven2 project resulting from the JVM running out of memory while trying to compile the code. A sign of project bloat? Yes. But also the sign of a silly build tool gone wrong.

The fix was to add some XML config to the project's pom.xml file:

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <fork>true</fork>
          <meminitial>128m</meminitial>
          <maxmem>512m</maxmem>
        </configuration>
      </plugin>
    </plugins>

I feel more productive already.

Technorati Tags: ,

archived on 2009-01-09 in

blog comments powered by Disqus