maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bogdan Calmac <>
Subject How to prevent hudson from proceeding after test failures
Date Fri, 19 Nov 2010 00:56:22 GMT

This is in reply to an earlier post where I was complaining that hudson
changes default maven behavior and does not fail the build on test failures.
This means that the "deploy" goal would result in actually deploying the
artifacts even though the tests failed.

Here is the code from hudson.maven.reporters.SurefireArchiver.preExecute()
that changes mvn behavior to ignore test failures:

if (isSurefireTest(mojo)) {
            if (!"org.apache.maven.plugins",
"maven-failsafe-plugin", "integration-test")) {
                // tell surefire:test to keep going even if there was a
                // so that we can record this as yellow.
                // note that because of the way Maven works, just updating
system property at this point is too late
                XmlPlexusConfiguration c = (XmlPlexusConfiguration)
                if(c!=null &&
c.getValue().equals("${maven.test.failure.ignore}") &&

So, it is enough to explicitly define
<testFailureIgnore>false</testFailureIgnore> in the execution of the
surefire plugin or define the system property
-Dmaven.test.failure.ignore=false to prevent the override. I tested it and
it works. Huray!

Bogdan Calmac wrote:
> OK, I've also tested with a simple maven projects and (as you mentioned)
> the artifacts are still deployed even after the tests fail. 
> Now irrespective of the color of the balls and what hudson does on its
> side, I expect mvn to behave the same on hudson and cmd-line. If maven
> does not deploy artifacts after a test failure then hudson should respect
> that choice. I don't really need hudson to "improve" the way maven works.
> This is just a huge design bug of the hudson-maven integration.  And the
> behavior is not even optional. 
> Then you were saying that the hudson maven plugin is crappy. But I like
> the way it works in a project with many modules where it discovers the
> modules and can do incremental builds. I'm very satisfied with it so far,
> it's just this bug that spoils it.

View this message in context:
Sent from the Maven - Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message