Fail build on Checkstyle Warning Violation


Java 1.7u40 Gradle 1.7

I was wondering how I might fail a build if there are any checkstyle failures? Currently I have this block defined in my build.gradle:

checkstyle {
    ignoreFailures = false

Unfortunately, that only works on Checkstyle errors. I notice in the Ant configuration one can set a property to fail if warnings are above a certain threshold Checkstyle Ant, specifically the maxWarnings property. I’m not sure how to do this on Gradle!

Any help would be greatly appreciated!

Thank you.


1 Like

I don’t think this is currently possible. I’ve created GRADLE-2888 for this.

Hi Peter,

Thank you. Looking forward to a future fix :slight_smile: