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

[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

当前回答

在Windows (OpenJDK11, Maven 3.6.0, SUREFIRE 3.0.0-M1)上,我得到了根本原因:

# Created at 2018-11-14T14:28:15.629
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000006c7500000, 522190848, 0) failed; error='The paging file is too small for this operation to complete' (DOS error/errno=1455)

并通过增加分页文件大小来解决,例如这样。

其他回答

当我试图在运行JAVA = 1.8的windows 10环境上编译一个设置为1.7的maven项目时,确实遇到了同样的问题。

我通过将java版本从1.7更改为1.8来解决这个问题,如下所示。

 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.3</version>
    <configuration>
      <source>1.8</source>
      <target>1.8</target>
    </configuration>
  </plugin>

截至今天(2018年10月30日),我们注意到我们的构建在Jenkins中出现了这个错误。

这个错误有点误导人,需要查看target/surefire-reports/中转储的输出,才能看到以下错误消息:

Error: Could not find or load main class org.apache.maven.surefire.booter.ForkedBooter

这让我想到了下面的SO帖子,其中提到了OpenJDK 181中一个可能的错误:Maven surefire无法找到ForkedBooter类

那篇文章中的任何一个修复都解决了我的问题。具体来说,我使用了其中之一:

从docker容器maven:3.5.4-jdk-8中的构建切换到maven:3.5.4-jdk-8-alpine 重写Spring Boot的类加载器详细信息请参见:https://stackoverflow.com/a/50661649/1228408

使用maven surefire 2.21.0我解决了reuseForks选项值从true变为false的问题:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.21.0</version>
            <configuration>
                <reuseForks>false</reuseForks>
            </configuration>
        </plugin>
    </plugins>
</build>

我正在构建的整个配置部分是这样的:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.21.0</version>
            <configuration>
                <testFailureIgnore>true</testFailureIgnore>
                <skip>false</skip>
                <reuseForks>false</reuseForks>
                <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
                <argLine>-Dfile.encoding=UTF-8</argLine>
                <useSystemClassLoader>false</useSystemClassLoader>
                <includes>
                    <!--Test* classes for the app testing -->
                    <include>**/directory/Test*.java</include>
                </includes>
            </configuration>
        </plugin>
    </plugins>
</build>

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

版本2.22.2在fork jvm方面存在实际问题。 使用版本2.20 -它的工作就像一个魅力!


<groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>