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

[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

当前回答

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

set MAVEN_OPTS=-Xmx1024m

其他回答

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

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

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

我在升级到java 12后遇到了类似的问题,对我来说,解决方案是更新jacoco版本<jacoco.version>0.8.3</jacoco.version>

我的设想是

我的测试有很多日志输出(我的意思是很多!) Surefire插件v2.22.2 错误只发生在IDE内部,如果从命令行执行mvn命令则不会发生。 没有迹象显示Surefire插件中的任何.dump文件或Java二进制中的传统hs_err崩溃文件。

对我来说,有两件事一直是解决方案(它们是替代方案):

不使用fork:设置Surefire插件属性forkcount = 0。 增加Surefire插件属性 forkedProcessExitTimeoutInSeconds从30秒变成300秒。插件文档说,如果这个超时被击中,你会看到错误消息有一个超时在fork。我没有看到这样的错误消息,但是它一直在修复这个问题以增加这个超时值。

您可能希望使用解决方案(2),因为分叉是可取的。

Why?

我的理论是,如果有大量的日志输出,那么在fork关闭时仍然需要进行大量的处理(特别是如果您在一个IDE中运行,该IDE捕获输出并可能为其窗口内容使用内存映射文件)。简而言之:在测试完成时,仍有大量文本等待转发到IDE中。30岁似乎还不够。

这也解释了为什么有些开发者能够发现问题,而有些开发者却不能。在测试结束时,剩下多少输出处理可能是cpu功率、磁盘速度等的函数。

如果我在这一点上是正确的-不能证明它-那么所有的建议,如重定向日志输出和降低日志级别都是IMO处理症状,而不是原因。

添加配置文件后,我可以删除这个错误:

<profile>
            <id>surefire-windows-fork-disable</id>
            <activation>
                <os>
                    <family>Windows</family>
                </os>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-surefire-plugin</artifactId>
                            <configuration>
                                <forkCount>0</forkCount>
                                <useSystemClassLoader>false</useSystemClassLoader>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>

似乎这是一个关于maven的问题

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

set MAVEN_OPTS=-Xmx1024m