views:

608

answers:

2

Hi,

I'm compiling an open source project with "mvn install" but ended up with java.lang.OutOfMemoryError: Java heap space. I tried to execute java -Xmx256m but the output was java synopsis which indicated it's an invalid command.

I'm using jdk1.5.0_08, any ideas why this is happening?

Thanks,

+7  A: 

Set the environment variable:

MAVEN_OPTS="-Xmx512m"
cletus
Sometimes is good also to extend perm memory size - MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m"
cetnar
+1  A: 

It depends on which JVM instance require more memory. As example, if tests are forked (by default), and fails due OutOfMemoryError then try configure plugin which launching them:

        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <argLine>-Xmx1024m</argLine>
            </configuration>
        </plugin>
Andriy Plokhotnyuk