title: Maven Out of Memory Build Failure
body: <p>As of today, my maven compile fails.</p>
  
  <pre><code>[INFO] [ERROR] Unexpected
  [INFO] java.lang.OutOfMemoryError: Java heap space
  [INFO]  at java.util.Arrays.copyOfRange(Arrays.java:2694)
  [INFO]  at java.lang.String.&lt;init&gt;(String.java:203)
  [INFO]  at java.lang.String.substring(String.java:1877)
  </code></pre>
  
  <blockquote>
    <p>[ERROR] Out of memory; to increase the amount of memory, use the -Xmx
    flag at startup (java -Xmx128M ...)</p>
  </blockquote>
  
  <p>As of yesterday I had successfully run a maven compile. </p>
  
  <p>As of today, I just bumped up my heap to <strong>3 GB</strong>. Also, I only changed 2-3 minor lines of code, so I don't understand this 'out of memory' error.</p>
  
  <pre><code>vagrant@dev:/vagrant/workspace$ echo $MAVEN_OPTS
  -Xms1024m -Xmx3000m -Dmaven.surefire.debug=-Xmx3000m
  </code></pre>
  
  <p>EDIT: I tried the poster's comment by changing my failed module's pom.xml. But I got the same maven build error.</p>
  
  <pre><code>    &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
          &lt;configuration&gt;
              &lt;source&gt;1.5&lt;/source&gt;
              &lt;target&gt;1.5&lt;/target&gt;
              &lt;fork&gt;true&lt;/fork&gt;
              &lt;meminitial&gt;1024m&lt;/meminitial&gt;
              &lt;maxmem&gt;2024m&lt;/maxmem&gt;
         &lt;/configuration&gt;
      &lt;/plugin&gt;
  </code></pre>