Execute post-integration-test phase when pre-integration-tests fail

Viewed 151

During pre-integration-tests Maven phase I'm setting up some tests environment.

Let's suppose I'm starting a database and a mock server (in that order)

Sometimes, the port of the mock server is already allocated, so my build fails in pre-integration-tests phase.

The problem? The database was started and was not shut down in post-integration-tests because that phase was not executed at all.

Maven always executes post-integration-tests even if there were errors in integration-tests, which is great, but I need to also execute post-integration-tests when pre-integration-tests phase has failed.

Any advice?

Thanks!

0 Answers
Related