scalatest Java heap space issue on maven

740 views
Skip to first unread message

SiM

unread,
Mar 11, 2010, 4:19:42 PM3/11/10
to scalatest-users, bi...@artima.com, in.i...@gmail.com
There has been an earlier discussion of removing Java heap errors from
scalatest on ant build script. However, I'm using Mac OSX with maven2
and finding it hard to remove the same errors. Can you kindly provide
any configuration parameter to set in say /etc/launchd.conf file or
project pom.xml to get rid of Java heap space problem?
I'm using following params
JAVA_OPTS="-Xmx2048M"
MAVEN_OPTS="-Xmx1536M"

The link to the other discussion is as follows:
http://groups.google.com/group/scalatest-users/browse_thread/thread/3669c14f54e4024d/70a7d3cbbef4c548?lnk=gst&q=java+heap+space#70a7d3cbbef4c548

Would really appreciate your quick response!
-SiM

SiM

unread,
Mar 11, 2010, 5:51:26 PM3/11/10
to scalatest-users, bi...@artima.com, in.i...@gmail.com
I found the fix after much troubleshooting. Firstly, I edited my file
/etc/launchd.conf
with

setenv JAVA_HOME /System/Library/Frameworks/JavaVM.framework/Versions/
1.6/Home
setenv JAVA_OPTS -Xmx2048m
setenv M2_HOME /usr/share/maven
setenv MAVEN_OPTS -Xmx1536m -XX:MaxPermSize=128m
setenv PATH /System/Library/Frameworks/JavaVM.framework/Versions/1.6/
Home/bin:/usr/share/maven/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/
bin:/usr/X11/bin

Then, I needed to add increase the jvm memory option in maven-scala-
plugin in my pom.xml.

look for the tag <jvmArgs> in the following pom.xml snippet

...
<build>
...
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.12.2</version>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<fork>true</fork>
<charset>${project.build.sourceEncoding}</charset>
<scalaVersion>${scala.version}</scalaVersion>
<args>
<arg>-target:jvm-1.5</arg>
</args>
<jvmArgs>
<jvmArg>-Xmx1536m</jvmArg>
</jvmArgs>
</configuration>
</plugin>
...
</build>
...


Re:

Aaron Masino

unread,
Mar 8, 2012, 12:21:20 PM3/8/12
to scalate...@googlegroups.com, bi...@artima.com, in.i...@gmail.com
I know this is an old post but it was a huge help. Thanks. For what it's worth, I only needed the <jvmArgs> portion of the suggested fix - not the JVM_OPTS or MAVEN_OPTS - to get past the heap space problem. 
Reply all
Reply to author
Forward
0 new messages