I have a maven build the launches a process (a database) using the exec plugin, then interacts with that process using several other plugin executions (the maven sql mojo) and then finally shuts down that process, using a 2nd execution od the exec plugin, bound to a later phase.
right now if any of the "middle" executions fail im left with a running process, which the build started but didnt get around to shutting down.
is there any "try/finally" mechanism in maven which i can use to clean up after a botched build?
Maybe, if you're using this workflow for testing, you could use test plugin like surefire or failsafe to prevent failing of your build process. And validate results after database if down. In short, start db in pre-test phase, run tests in separate process using plugins I've mentioned above, stop db in port-test phase and validate test results in verify? phase.
Failsafe plugin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With