java.lang.OutOfMemoryError : Maven의 Java 힙 공간
maven 테스트를 실행하면 java.lang.OutOfMemoryError가 발생합니다. 나는 해결책을 찾기 위해 그것을 구글하려고했지만 export MAVEN_OPTS=-Xmx1024m
작동하지 않았다. 누구나이 문제에 대한 다른 해결책을 알고 있습니다 .BTW maven 3.0을 사용하고 있습니다.
미리 감사드립니다
"mvn test -e"를 실행할 때 오류 메시지를 여기에 붙여 넣기
실패한 테스트 : 경고 (junit.framework.TestSuite $ 1) testDefaultPigJob_1 (com.snda.dw.pig.impl.DefaultPigJobLocalTest) testDefaultPigJob_2 (com.snda.dw.pig.impl.DefaultPigJobLocalTest) 테스트 실행 : 11, 실패 : 3, 오류 : 0, 건너 뛰기 : 0 01/11/01 13:37:18 정보 실행 엔진 HExecutionEngine : hadoop fi에 연결 파일 시스템 : file : /// [정보] ----------------------------------------------- ------------------------- [정보] 빌드 실패 [정보] ----------------------------------------------- ------------------------- [정보] 총 시간 : 30.063s [정보] 마감일 : 월요일 11 월 1 일 13:37:18 PDT 2010 [정보] 최종 메모리 : 3M / 6M [정보] ----------------------------------------------- ------------------------- [오류] org.apache.maven.plugins : maven-surefire-plugin : 2 목표를 실행하지 못했습니다. 프로젝트 dw.pig의 5 : test (기본 테스트) : 테스트 실패가 있습니다. [오류] [오류] E : \ Code \ Java \ workspace \ dw.pig \ target \ surefire-reports fo를 참조하십시오. 개별 시험 결과. [오류]-> [도움말 1] org.apache.maven.lifecycle.LifecycleExecutionException : 목표 o를 실행하지 못했습니다 프로젝트에서 rg.apache.maven.plugins : maven-surefire-plugin : 2.5 : test (기본 테스트) dw.pig : 테스트 실패가 있습니다. 에 대한 E : \ Code \ Java \ workspace \ dw.pig \ target \ surefire-reports를 참조하십시오. 개별 테스트 결과. org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor에서 .java : 199) org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor에서 .java : 148) org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor에서 .java : 140) org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje에서 ct (LifecycleModuleBuilder.java:84) org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje에서 ct (LifecycleModuleBuilder.java:59) org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu에서 ild (LifecycleStarter.java:183) org.apache.maven.lifecycle.internal.LifecycleStarter.execute (Lifecycl에서 eStarter.java:161) org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:314)에서 org.apache.maven.DefaultMaven.execute에서 (DefaultMaven.java:151) org.apache.maven.cli.MavenCli.execute (MavenCli.java:445) org.apache.maven.cli.MavenCli.doMain (MavenCli.java:168)에서 org.apache.maven.cli.MavenCli.main (MavenCli.java:132) at sun.reflect.NativeMethodAccessorImpl.invoke0 (네이티브 메소드) sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl. 자바 : 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAcces에서 sorImpl.java:25) java.lang.reflect.Method.invoke (Method.java:597)에서 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Laun에서) cher.java:290) org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.jav)에서 a : 230) org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (La uncher.java:409) org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java : 352) 원인 : org.apache.maven.plugin.MojoFailureException : 테스트 실패가 있습니다 . 에 대한 E : \ Code \ Java \ workspace \ dw.pig \ target \ surefire-reports를 참조하십시오. 개별 테스트 결과. org.apache.maven.plugin.surefire.SurefirePlugin.execute (SurefirePlugi) n.java:629) org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (기본값 BuildPluginManager.java:107) org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor에서 .java : 195) ... 19 더보기 [오류] [오류] 전체 디버그 로깅을 활성화하려면 -X 스위치를 사용하여 Maven을 다시 실행하십시오. [오류] [오류] 오류 및 가능한 해결책에 대한 자세한 내용은 다음을 참조하십시오. d 다음 기사 : [오류] [도움말 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
maven 테스트를 실행하면 java.lang.OutOfMemoryError가 발생합니다. 솔루션을 위해 Google에서 MAVEN_OPTS = -Xmx1024m을 내보내려고 시도했지만 작동하지 않았습니다.
Setting the Xmx
options using MAVEN_OPTS
does work, it does configure the JVM used to start Maven. That being said, the maven-surefire-plugin forks a new JVM by default, and your MAVEN_OPTS
are thus not passed.
To configure the sizing of the JVM used by the maven-surefire-plugin, you would either have to:
- change the
forkMode
tonever
(which is be a not so good idea because Maven won't be isolated from the test) ~or~ - use the
argLine
parameter (the right way):
In the later case, something like this:
<configuration>
<argLine>-Xmx1024m</argLine>
</configuration>
But I have to say that I tend to agree with Stephen here, there is very likely something wrong with one of your test and I'm not sure that giving more memory is the right solution to "solve" (hide?) your problem.
References
For those new to Maven (like me) here is the whole config that goes in the build section of your pom. Cheers.
<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>
The chances are that the problem is in one of the unit tests that you've asked Maven to run.
As such, fiddling with the heap size is the wrong approach. Instead, you should be looking at the unit test that has caused the OOME, and trying to figure out if it is the fault of the unit test or the code that it is testing.
Start by looking at the stack trace. If there isn't one, run mvn ... test
again with the -e
option.
To temporarily work around this problem, I found the following to be the quickest way:
export JAVA_TOOL_OPTIONS="-Xmx1024m -Xms1024m"
I have solved this problem on my side by 2 ways:
Adding this configuration in pom.xml
<configuration><argLine>-Xmx1024m</argLine></configuration>
Switch to used JDK 1.7 instead of 1.6
In order to resolve java.lang.OutOfMemoryError: Java heap space in Maven, try to configure below configuration in pom
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<argLine>-XX:MaxPermSize=500M</argLine>
</configuration>
</plugin>
Not only heap memory. also increase perm size to resolve that exception in maven use these variables in environment variable.
variable name: MAVEN_OPTS
variable value: -Xmx512m -XX:MaxPermSize=256m
Example :
export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=500m"
참고URL : https://stackoverflow.com/questions/4066424/java-lang-outofmemoryerror-java-heap-space-in-maven
'IT박스' 카테고리의 다른 글
LINQ to SQL : 여러 열에서 여러 조인 (0) | 2020.07.18 |
---|---|
CancellationToken이 CancellationTokenSource와 다른 이유는 무엇입니까? (0) | 2020.07.18 |
git이 경로별로 하드 / 소프트 리셋을 수행 할 수없는 이유는 무엇입니까? (0) | 2020.07.17 |
PyLint 메시지 : logging-format-interpolation (0) | 2020.07.17 |
C #에서 문자열 인코딩 결정 (0) | 2020.07.17 |