Checkstyle plugin adds task checkstyleMain, that checks my sources with property ignoreFailures = true it means that this task won’t fail build on any checkstyle violations.
I need new one task(copy of checkstyleMain), that will run with property ignoreFailures = false that will fail build on any violations.
My solutions should look in the next way but it doesn’t work
Different question: Why use ignoreViolations = true? You can always use gradle sca --continue and the build will fail, but only after all other checks have finished too.
That way you don’t need a property or a second task at all.
We have Jenkins CI builds that run gradle clean build. At this moment we don’t think that checkstyle should fail this builds(usually it’s minor violations, time to rebuild all submodules, our team doesn’t decided to use checkstyle finally). Jenkins just displays violations on diagram.
To lead team members to fix checkstyle violations(locally), I created sca task. Instead of entering gradle pmdMain checkstyleMain -PforceCheckstyle findbugsMain
they can just enter gradle sca and have profit. Recently, we started to use gitlab-ci that builds branches before merge, so I can add task sca there as well.
so I really need to have checkstyleMain that ignore violations and other task that fail build
Theoretically I can set ignoreViolations = true and then add additional flag like -PignoreChekstyleViolations on jenkins for ALL CI builds, but it doesn’t look like the best solution.
One small question at the end:
Is it possible to apply --continue to the task without command line argument? (I mean to run gradlew sca instead of gradlew sca --continue)