meteor
meteor

Reputation: 2568

Force execution of a Maven phase

I have a Maven POM with pre-integration-test and post-integration-test phases as follows.

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

How do I force post-integration-test phase to be executed even when the pre-integration-test phase fails? Right now, if pre-integration-test phase fails the post-integration-test phase doesn't get executed.

Upvotes: 3

Views: 1063

Answers (1)

Viktor Mellgren
Viktor Mellgren

Reputation: 4506

Taken from 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)

Upvotes: 1

Related Questions