facewindu facewindu - 1 year ago 189
Java Question

gradle ignoreFailures test property


file is like the following :

apply plugin: "java"
test {
ignoreFailures = "$ignoreFailureProp"

and a


When executed
gradle clean build
, the unit test failures do not mark the build as failed.

I know the default behaviour is to fail the build, but I want to explicitly set it through a property, to change in without modifying the build file

Answer Source

The problem is that ignoreFailureProp property is a string so the ignoreFailures (which should be a boolean) is set as a string and therefore will always be true.

You could do this instead:

apply plugin: "java"

test {
    ignoreFailures = ignoreFailureProp.toBoolean()

This should work.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download