Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-4558

Out of memory error during compilation when using the install phase but not when using the compile phase



    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Not A Problem
    • Affects Version/s: 2.2.1
    • Fix Version/s: None
    • Component/s: Errors, Plugin API
    • Labels:
    • Environment:
      Mac OS X 10.6.2 (32 bit); MacBook Pro (Intel Core 2 duo); Java 1.6.0_17


      We've had to set the environment variable MAVEN_OPTS to "-Xmx1024m" in order to avoid running out of memory during compilation of our project. Once we did that, there were no problems with 2.0.10. After upgrading to 2.2.1 (also confirmed to be a problem on 2.2.0), the out of memory error comes back.

      We tried to narrow down the problem and zeroed in on our Maven install. Our assumption is that the MAVEN_OPTS aren't being passed to the javac command with 2.2.0 and 2.2.1 but are with 2.0.10.

      Reverting to 2.0.10 solves this problem.

      We tried to add a compiler plugin configuration to turn on verbose logging hoping that we could then see the javac command before it was run but had no luck. I can re-run our tests on this side if someone can provide the correct way to force maven to spit out the command its running before it runs so we can verify our assumption that the MAVEN_OPTS aren't being used in 2.2.* but were in 2.0.10.

      Here's a copy of the stack trace for the install command:

      [INFO] [enforcer:enforce

      {execution: enforce-java}

      [INFO] [resources:resources

      {execution: default-resources}

      [INFO] Using default encoding to copy filtered resources.
      [INFO] [compiler:compile

      {execution: default-compile}

      [INFO] Compiling 624 source files to /Users/<omitted>
      [INFO] ------------------------------------------------------------------------
      [INFO] ------------------------------------------------------------------------
      [INFO] Compilation failure
      Failure executing javac, but could not parse the error:

      The system is out of resources.
      Consult the following stack trace for details.
      java.lang.OutOfMemoryError: Java heap space
      at com.sun.tools.javac.code.Type$ClassType.constType(Type.java:559)
      at com.sun.tools.javac.comp.Attr.visitLiteral(Attr.java:2387)
      at com.sun.tools.javac.tree.JCTree$JCLiteral.accept(JCTree.java:1570)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
      at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:377)
      at com.sun.tools.javac.comp.Annotate.enterAttributeValue(Annotate.java:179)




            • Assignee:
              bentmann Benjamin Bentmann
              chriswilliams Chris Williams
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: