OutOfMemoryError for Maven Build on IJ9 CE

I'm pretty sure this is due to the forked jvm not the ij jvm.

Why?  I've set the Mx512M in idea.exe.vmoptions, yet the following build crashes at 63meg

     -Xmx512M

Also, I've put inside the mvn.bat file in the maven installation:

   set M2_OPTIONS="-Xmx512M"

And even added that to my system env variables.  Still getting the below error.

So .. how does one configure the embedded maven launched JVM ?


INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Java heap space
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Arrays.java:3057)
    at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:117)
    at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:592)
    at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile(DefaultMavenFileFilter.java:83)
...
    at org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources(DefaultMavenResourcesFiltering.java:293)
    at org.apache.maven.plugin.resources.ResourcesMojo.execute(ResourcesMojo.java:162)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
...
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:613)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22 seconds
[INFO] Finished at: Wed Mar 03 15:38:41 PST 2010
[INFO] Final Memory:
38M/63M

4 comments

On 2010-03-04 03:47:05 +0100, Stephen Boesch <no_reply@jetbrains.com> said:

So .. how does one configure the embedded maven launched JVM ?


Go to Settings -> Maven -> Runner. There you can set up the VM
parameters for the embedded runner.

0

I think that will work for the problem he posted, but I have a similar problem that that does not fix.  When I run release:prepare or release:perform, the Maven JVM forks another Maven JVM.  This is suggested by nested [INFO] in the output, e.g.:

[INFO] [INFO] [hpi:hpi {execution: default-hpi}]

The child JVM does not get the same parameters.  That's good in the case of a debug port, as I assume that they could not share the same port, but it's bad when the child needs more heap, or when I need to debug the child instead of the parent.  Does anyone know a solution for this?

0

I got the child Maven heap I needed in IntelliJ by creating ~/.MacOSX/environment.plist containing:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>MAVEN_OPTS</key>
    <string>-Xmx300m</string>
  </dict>
</plist>

and then logging in again.  But shouldn't there be an easier way to do this in IntelliJ?  And, it's also used for the parent Maven, so it doesn't seem like it would work for debugging the child Maven.

By the way, I tried to set MAVEN_OPTS for IntelliJ specifically, by adding this dict to its Info.plist in an LSEnvironment key, but I couldn't get that to work.  I guess it's better to have it global, anyway, for updates.

0

Please sign in to leave a comment.