I have a Gradle build in Jenkins with various JUnit tests that are executed as part of the build. Now when some of the tests fail the complete build is marked as failed - because Gradle says the build failed.
How can I convince Gradle to succeed the build and then Jenkins to mark the build as unstable? With ant this was no problem at all.
In Jenkins Terminology, an unstable build is defined as: A build is unstable if it was built successfully and one or more publishers report it unstable. For example if the JUnit publisher is configured and a test fails then the build will be marked unstable.
To skip any task from the Gradle build, we can use the -x or –exclude-task option. In this case, we'll use “-x test” to skip tests from the build. As a result, the test sources aren't compiled, and therefore, aren't executed.
Use the ignoreFailures property in the test task.
apply plugin: 'java' test { ignoreFailures = true }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With