I am trying to set up integration testing in maven (v2) to be executed via Jenkins. I'm bringing up a large software stack (via the exec-maven-plugin) in the pre-integration-test phase of the maven POM. Unfortunately, this bring-up sometimes fails (clearly I need more testing), which fails the build immediately. The problem is, the stack is not completely up and not completely down after a failure. I could clean up via another call to the exec-maven-plugin, but the maven build ends immediately so I don't get a chance.
I'm leaning on the maven-failsafe-plugin to ensure cleanup happens if any of the tests fail, but how can I get things cleaned up when pre-integration-test fails?