【发布时间】:2014-08-15 09:33:33
【问题描述】:
在运行声纳分析时,我们不断出现内存不足错误。它在机器之间是间歇性的,但似乎一旦你得到它,它就会持续存在。
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-cli) on project optimus-client-web-configuration: Execution default-cli of goal org.apache.maven.plugins:
maven-surefire-plugin:2.16:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?
[ERROR] Command wascmd.exe /X /C ""C:\Program Files\Java\jdk1.7.0_45\jre\bin\java" -javaagent:C:\Users\cxxx\AppData\Local\Temp\jacocoagent8301608889470684052.jar=destfile=target/jacoco.exec,excludes=
*_javassist_* -jar C:\redesign_Trunk\optimus-lms-server\optimus-client-web-configuration\target\surefire\surefirebooter2312966376869893038.jar C:\redesign_Trunk\optimus-lms-server\optimus-client-web-con
figuration\target\surefire\surefire350975689095180011tmp C:\redesign_Trunk\xxx-xx-server\xxx\target\surefire\surefire_45613339175612175619tmp"
在声纳阶段之前运行时,单元测试不会因此而失败。它发生在一项特定的测试中,该测试激活了 Spring 配置以测试它是否可以正常工作。由于必须加载整个上下文,因此该测试可能比大多数测试消耗更多的内存。
我增加了 MAVEN_OPTS 中的内存以使用 1024M 最大堆。将此配置添加到我的 pom 中
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<argLine>-Xmx1024m</argLine>
</configuration>
</plugin>
【问题讨论】:
标签: java maven out-of-memory sonarqube maven-surefire-plugin