2
votes

I recently discovered that Hudson was not the problem. In actuality it was Maven itself as the multi-module build was causing the build failure, not Hudson. I just hadn't noticed where the issue actually existed.

Leaving the original question here.


I'm using the failsafe-maven-plugin to run some integration tests. The difference between failsafe and surefire is that failsafe allows failures and does not fail the build.

On my nightly builds there are occasions that a service the integration tests use might be down. In normal builds, the failsafe plugin would let the build continue since the integration tests are allowed to fail. However, Hudson does not seem to respect this and stops the build and produces rain.

I tried to turn the failsafe tests off on nightly builds using -DskipITs. This appears to fail since I'm in a multi module build.

Any ideas on how to get Maven to respect that these tests can fail even though they're part of a specific module?

The project structure is as follows:

-parent
\-jar
\-jar (where integration tests run)
\-war
\-ear
3
Are these integration tests in a specific directory or in a dedicated module (this is not what I understood)? If not, why not? Can you tell us a bit more about the multi-module structure? What goal do you run for nightly builds, the verify goal?Pascal Thivent
I'm actually running install on a nightly basis at the top level parent pom.Mike Cornell

3 Answers

0
votes

You can use profiles to make builds a bit different for different environments (nightly builds, releases, normal developer builds and so on).

I'd also try updating the Maven version, there were recently few fixes related to multi-module builds.

0
votes

I don't believe your original assumption that failsafe-maven doesn't fail the build is correct. A failed test does not stop the integration-test phase from completing, which is different from the surefire plugin that runs unit tests. This allows the post-integration-test phase to run, so the test environment can be torn down (app server shut down, etc.).

After this, the verify phase is run, which looks at the results of the integration tests. if one of these tests has failed, then Maven will return with a build failure, which Hudson will rightly pick up so your build can be flagged as broken.

0
votes

Use a maven profile to turn on/off the verify goal of the maven failsafe plugin.