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 (!mojo.is("org.apache.maven.plugins",
"maven-failsafe-plugin", "integration-test")) {
                // tell surefire:test to keep going even if there was a
failure,
                // 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)
mojo.configuration.getChild("testFailureIgnore");
                if(c!=null &&
c.getValue().equals("${maven.test.failure.ignore}") &&
System.getProperty("maven.test.failure.ignore")==null)
                    c.setValue("true");
            }
        }

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: 
http://maven.40175.n5.nabble.com/Running-tests-twice-and-the-build-success-status-tp3257693p3271735.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to