2

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?

Jared
  • 1,887
  • 3
  • 20
  • 45
  • By the way, for now I'm running an extra clean-up in the initialize phase now to prevent subsequent builds from failing on the same system. Still it seems incorrect or at least inefficient to rely on this. What if another build were to be triggered here instead of this same build? The partially running stack from a previous build could cause problems. – Jared Aug 12 '11 at 15:11
  • why dont you just call clean and you will ensure that every build regardless of failure or not is cleaned before the new install is run. – Mahdi Yusuf Aug 15 '11 at 13:27
  • That's what I mentioned doing in my first comment, but what if a DIFFERENT module is built there after this one? Do I really need to suck in the dependencies required to clean up after this build in EVERY OTHER POSSIBLE BUILD just because I couldn't clean up after myself here? What if the new module being built is owned by a different group/division? – Jared Aug 15 '11 at 13:31
  • okay you can do this, btw I still dont see why what I suggested is a problem. but you can run all these in a bash script if the return value at any point is a non zero run the clean if not, keep calm and carry on. – Mahdi Yusuf Aug 15 '11 at 14:08
  • @dustyprogrammer: Really? A bash script? If I have to revert to writing a bash script then maven has failed me miserably (platform independence anyone?). I'd think at least you'd be suggesting an antrun job so I'm not depending on a bash script to run on a Windows box (yes I know about Cygwin, no I don't want my builds depending on it), and not having to maintain separate Linux and Windows scripts. – Jared Aug 16 '11 at 16:13
  • you can write both batch and bash scripts with jenkins. – Mahdi Yusuf Aug 16 '11 at 16:52

0 Answers0