Pages

Thursday, December 22, 2011

OutOfMemory with Maven Compiler ?

When using Maven with Jdk 6 (1.6.0_14) within eclipse, OutOfMemory error is encountered
Setting MAVEN_OPTS as per the suggestions was of no help.
The following configuration setting inside the ma ven compile plugin worked like a wonder!

<configuration>

<fork>true</fork>
<meminitial>256m</meminitial>
<maxmem>512m</maxmem>
</configuration>

Upon investigation, there is a note on the attribute <fork>
<fork> attribute, when set to true, allows running the compiler in a separate process and use defined heap value as against using default built-in compiler. (By default, fork is false)

Hence, the solution is having the compiler use a separate process as against the default. Another important observation is that i haven't encountered this exception when i used jdk1.6.0_23 + version.