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

[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

当前回答

我也遇到了同样的问题,我使用了Oracle的Java 8而不是Openjdk的Java 10来解决这个问题

其他回答

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

<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>

这似乎是某些Windows机器上的线程同步问题。如果你在Windows上遇到这个问题,试着将输出重定向到一个文件:mvn clean install > output.txt

在我的案例中,这个问题与IntelliJ IDEA控制台(OS windows 10)的日志输出时间过长有关。 命令:

mvn clean install

这个命令解决了我的问题:

mvn clean install > log-file.log

这将工作肯定.....

在POM文件中添加以下行并给出一个构建。

<plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.19.1</version>
          <configuration>
            <trimStackTrace>false</trimStackTrace>
            <includes>
              <include>**/*Test.class</include>
            </includes>
          </configuration>
        </plugin>

如果有人包含自定义argLine参数,则必须重新考虑,因为它很可能是内存分配问题的根源。

例如(我曾经有过):

<argLine>XX:MaxPermSize=4096m ${argLine}</argLine>

现在我使用硬指定值:

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

无论出于何种原因,与Surefire集成的应用程序(如Jacoco)不会请求足够的内存来与构建时发生的测试共存。