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

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

我尝试了所有提供的解决方案(分叉,系统加载器,更多的内存等),没有工作。

环境:在gitlab ci环境中构建失败,在docker容器中运行构建。

解决方案: 我们在2.20.1版本中使用surefireplugin,升级到2.21.0或更高版本(我们使用2.22.1)修复了这个问题。

原因: surefire -1422 - surefire使用ps命令,该命令在docker环境中不可用,导致“崩溃”。此问题在2.21.0或更高版本中修复。

感谢另一个问题的答案:https://stackoverflow.com/a/50568662/2970422

在将Maven从2.6.3更新到2.8.4之后,我遇到了同样的问题。问题是分叉JVM崩溃的内存不足,所以只是增加内存从1024Mb到2048Mb在Surefire插件配置,这解决了这个问题

        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <!--suppress UnresolvedMavenProperty -->
                <argLine>${argLine} -Dfile.encoding=UTF-8 -Xmx2048m</argLine>
            </configuration>
        </plugin>

分叉的VM没有正确地说再见就终止了。虚拟机崩溃或系统崩溃。出口被称为

防止此错误的方法是以管理员身份运行IDE。

我的决心是将Jenkinsfile中提到的超时时间从90更改为120。

pipeline {
    agent { label projectName }

options {
    disableConcurrentBuilds()
    buildDiscarder(logRotator(numToKeepStr:'5'))
    timeout(time: 90, unit: 'MINUTES')
}

谢谢 南非