Error java lang OutOfMemoryError Java heap space in Maven

0 votes

When I run maven test, java.lang.OutOfMemoryError happens. I have tried to export MAVEN_OPTS=-Xmx1024m, but it did not work.

Paste the error message here when run "mvn test -e"

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.buildProject
ct(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject

Anyone know other solutions for this problem?

Thanks in advance

Jun 3, 2020 in Java by kartik
• 37,520 points
12,993 views

1 answer to this question.

0 votes

Hello @kartik,

Here is the whole config that goes in the build section of your problem.

<build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19</version>
        <configuration>
            <argLine>-Xmx1024m</argLine>
        </configuration>
      </plugin>
    </plugins>
  </build>

Hope this helps!!

To know more about Java, join our Java course online today.

Thank you

answered Jun 3, 2020 by Niroj
• 82,880 points

Related Questions In Java

0 votes
1 answer

java.lang.OutOfMemoryError: GC overhead limit exceeded Error

This simply means that for some reason ...READ MORE

answered May 31, 2018 in Java by misc.edu04
• 1,450 points
4,475 views
+1 vote
1 answer

How can we resolve java.lang.OutOfMemoryError in Java?

Work with smaller batches of HashMap Objects ...READ MORE

answered Jun 5, 2018 in Java by sharth
• 3,370 points
984 views
0 votes
0 answers

Exception in thread "main" java.lang.Error: Unresolved compilation problems

I am facing issues importing classes and ...READ MORE

May 7, 2022 in Java by narikkadan
• 63,680 points
5,469 views
0 votes
0 answers

Error java.lang.OutOfMemoryError: GC overhead limit exceeded

When I execute my JUnit tests I am getting ...READ MORE

May 15, 2022 in Java by Kichu
• 19,050 points
557 views
0 votes
1 answer

How do I configure Maven for offline development?

Hello @kartik, You have two options for this: 1.) ...READ MORE

answered Jun 3, 2020 in Java by Niroj
• 82,880 points
779 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,987 views
0 votes
1 answer

Error:“java.lang.OutOfMemoryError: PermGen space” in Maven build

Hello @kartik, When you increased MAVEN_OPTS, you increase the MaxPermSize, ...READ MORE

answered Jun 3, 2020 in Java by Niroj
• 82,880 points
1,763 views
0 votes
1 answer

Error:“java.lang.OutOfMemoryError: Java heap space” ?

Hii, Possible causes: Simple configuration issue, where the specified ...READ MORE

answered Apr 8, 2020 in Java by Niroj
• 82,880 points
1,097 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP