请帮我解决这个问题。我不太明白日志中的错误是什么意思。

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.749s
[INFO] Finished at: Thu Apr 24 10:10:20 IST 2014
[INFO] Final Memory: 15M/37M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.15:test (default-test) on project samples.simpleforwarding: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.15: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_55\jre\bin\java" -Xmx1024m -XX:MaxPermSize=256m -jar E:\OpenDayLight\controller\opendaylight\samples\simpleforwarding\target\surefire\surefirebooter53410321571238933.jar E:\OpenDayLight\controller\opendaylight\samples\simpleforwarding\target\surefire\surefire86076271125218001tmp E:\OpenDayLight\controller\opendaylight\samples\simpleforwarding\target\surefire\surefire_01846991116135903536tmp"
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

当前回答

我也遇到了同样的问题,并添加了如下内容:

<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>

整个plugin元素是:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <configuration>
    <forkCount>3</forkCount>
    <reuseForks>true</reuseForks>
    <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
  </configuration>
</plugin>

其他回答

您需要检查您的机器是64位还是32位。如果你的机器是32位的,那么你的内存参数不应该超过4096,即使它应该低于4 GB。 但如果你的机器是64位的,那么安装Java 64位,并在mvn.bat中提供JAVA_HOME,指向Java 64位安装。

在我的情况下,通过设置MAVEN_OPTS增加内存有助于:

set MAVEN_OPTS=-Xmx1024m

我最近在JHipster 6.10.5使用spring-boot 2.2.7生成的应用程序中遇到了同样的问题。RELEASE和maven surefire插件3.0.0-M4。这是由于非常长的测试日志造成的超时。通过在pom.xml中的maven-surefire-plugin(在pluginManagement下)中添加以下配置参数来解决:

1200年< forkedProcessExitTimeoutInSeconds > < / forkedProcessExitTimeoutInSeconds >

看到https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html forkedProcessExitTimeoutInSeconds

在调试模式下运行了几十次Maven之后,我遇到了这样的情况:

-Dmaven.surefire.debug="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"

由于某些原因,我不得不杀死仍在并行运行的额外java进程。

我更新了surefire插件如下,这解决了我的问题:

           <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
                    <forkCount>1</forkCount>
                    <reuseForks>true</reuseForks>
                    <runOrder>alphabetical</runOrder>
                </configuration>
            </plugin>