gpt4 book ai didi

java - 强制执行 Maven 阶段

转载 作者:行者123 更新时间:2023-11-30 11:02:29 25 4
gpt4 key购买 nike

我有一个带有 pre-integration-testpost-integration-test 阶段的 Maven POM,如下所示。

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

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

最佳答案

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

If you use the Surefire Plugin for running tests, then when you have a test failure, the build will stop at the integration-test phase and your integration test environment will not have been torn down correctly.

The Failsafe Plugin is used during the integration-test and verify phases of the build lifecycle to execute the integration tests of an application. The Failsafe Plugin will not fail the build during the integration-test phase, thus enabling the post-integration-test phase to execute.

NOTE: when running integration tests, you should invoke Maven with the (shorter to type too)

关于java - 强制执行 Maven 阶段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30759612/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com