title: java.lang.OutOfMemoryError: Java heap space in Maven
body: <p>When I run maven test, <code>java.lang.OutOfMemoryError</code> happens. I googled it for solutions and have tried to <code>export MAVEN_OPTS=-Xmx1024m</code>, but it did not work.
  Anyone know other solutions for this problem? I am using maven 3.0</p>
  <p>Paste the error message here when run <code>mvn test -e</code></p>
  <pre>
  Failed tests:
    warning(junit.framework.TestSuite$1)
    testDefaultPigJob_1(com.snda.dw.pig.impl.DefaultPigJobLocalTest)
    testDefaultPigJob_2(com.snda.dw.pig.impl.DefaultPigJobLocalTest)
  
  Tests run: 11, Failures: 3, Errors: 0, Skipped: 0
  
  10/11/01 13:37:18 INFO executionengine.HExecutionEngine: Connecting to hadoop fi
  le system at: file:///
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 30.063s
  [INFO] Finished at: Mon Nov 01 13:37:18 PDT 2010
  [INFO] Final Memory: 3M/6M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
  5:test (default-test) on project dw.pig: There are test failures.
  [ERROR]
  [ERROR] Please refer to E:\Code\Java\workspace\dw.pig\target\surefire-reports fo
  r the individual test results.
  [ERROR] -> [Help 1]
  org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
  rg.apache.maven.plugins:maven-surefire-plugin:2.5:test (default-test) on project
   dw.pig: There are test failures.
  
  Please refer to E:\Code\Java\workspace\dw.pig\target\surefire-reports for the in
  dividual test results.
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
  .java:199)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
  .java:148)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
  .java:140)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
  ct(LifecycleModuleBuilder.java:84)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
  ct(LifecycleModuleBuilder.java:59)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
  ild(LifecycleStarter.java:183)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
  eStarter.java:161)
          at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:314)
          at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:151)
          at org.apache.maven.cli.MavenCli.execute(MavenCli.java:445)
          at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:168)
          at org.apache.maven.cli.MavenCli.main(MavenCli.java:132)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
  java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
  sorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
  cher.java:290)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
  a:230)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
  uncher.java:409)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
  352)
  Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures
  .
  
  Please refer to E:\Code\Java\workspace\dw.pig\target\surefire-reports for the in
  dividual test results.
          at org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugi
  n.java:629)
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
  BuildPluginManager.java:107)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
  .java:195)
          ... 19 more
  [ERROR]
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR]
  [ERROR] For more information about the errors and possible solutions, please rea
  d the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
  </pre>