强制执行Maven阶段

时间:2015-06-10 14:39:52

标签: java maven

我有一个Maven POM,其pre-integration-testpost-integration-test阶段如下。

<execution>
    <id>start-server</id>
    <phase>pre-integration-test</phase>
    <goals>
        <goal>start-server</goal>
    </goals>
    <configuration>
    </configuration>
</execution>
<execution>
    <id>stop-running-server</id>
    <phase>post-integration-test</phase>
    <goals>
        <goal>stop-server</goal>
    </goals>
    <configuration>
        <skip>false</skip>
    </configuration>
</execution>

即使post-integration-test阶段失败,如何强制执行pre-integration-test阶段?现在,如果pre-integration-test阶段失败,则post-integration-test阶段不会被执行。

1 个答案:

答案 0 :(得分:1)

取自http://maven.apache.org/surefire/maven-failsafe-plugin/

  

如果你使用Surefire插件运行测试,那么当你有一个   测试失败,构建将在集成测试阶段停止   您的集成测试环境不会被拆除   正确。

     

在集成测试和验证期间使用Failsafe插件   构建生命周期的各个阶段,用于执行一个集成测试   应用。故障安全插件不会在构建过程中失败   集成测试阶段,从而实现集成后测试阶段   执行。

     

注意:运行集成测试时,应该使用   (也可以缩短类型)