Set gradle build failed/unstable in Jenkins

In gradle,
test.ignoreFailures true
will allow build to continue even if there are junit test failures. And this is a desired behavior.

What we want is to set the FINAL build result to failed. Or at least let Jenkins know the final result FAILED or UNSTABLE. What is the best approach?

Hell, Chris L,

The following works for me:

  • add to build.gradle file after the dependencies block:
    tasks.withType(Test) {
    group ‘test’
    description ‘That would be added to the Gradle tree to Project under the Task’
    doFirst {
    // some stuff
    // that will do all required test and after would make it proper you are looking for a marked build as unstable a CI side
    ignoreFailures = true

Hope it will solve your problem.