Maven Failsafe:验证始终返回退出代码0

时间:2014-09-16 12:21:26

标签: java maven-3 java-8 maven-failsafe-plugin

我的集成测试存在异常恼人的问题,Maven故障安全插件返回的退出代码为0,无论测试的实际结果如何:

例如,运行'mvn verify'显示:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 23.519s
[INFO] Finished at: Tue Sep 16 13:12:55 BST 2014
[INFO] Final Memory: 53M/512M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.6:verify       (verify) on project [my.project]: There are test failures.

...

echo $?
0

failsafe config:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.17</version>

    <executions>
        <execution>
            <id>integration-test</id>
            <goals>
                <goal>integration-test</goal>
            </goals>
        </execution>
        <execution>
            <id>verify</id>
            <goals>
                <goal>verify</goal>
            </goals>
        </execution>
    </executions>
</plugin>

我之前从未见过这个问题,它使我的CI堆栈变得毫无价值,因为如果测试失败,构建不会失败!我和过去做过的类似事情的唯一区别就是我在这里使用java 8。

1 个答案:

答案 0 :(得分:0)

解决了我自己的问题 - 看起来maven jetty插件的stop-jetty执行导致了退出代码的奇怪行为。删除stop-jetty执行修复了错误(我的CI将杀死Jetty)