Friday, September 5, 2008

How to avoid OutofMemory error when building projects with Maven2

You may have encountered outofMemory issues when building source with Maven2. This normally happens when Maven runs out of available system memory.
In such case you have to set MAVEN_OPTS environment variable to increase the available memory.

In Windows
Open a command prompt in which you build the source and enter the following options. (Change the memory size according to the amount of memory in your system)
SET MAVEN_OPTS=-Xmx1024m

In Linux
Open a shell and set the options as follows.
export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m"

No comments:

Post a Comment