Our build has a problem with Checkstyle intermittently crashing. A process crash, as opposed to a rule violation, has a “Got an exception - null” message in the console/logs:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':product-tests:java:libraries:ServerAdministrationLib:checkstyleMain'.
> Checkstyle rule violations were found. See the report at: file:///D:/tc/work/server-dev/shared/product-tests/java/libraries/ServerAdministrationLib/build/reports/checkstyle/main.html
ConfigurationVersion.java:0: Got an exception - null
We, unfortunately, use an old version of Checkstyle (6.5) so that may be the source of some of the reliability issues. Upgrading to the current version (7.5.1) is something I’d like to do but given the many thousands of violations the upgraded version turns up, it would be a long and tedious process.
Until the work to upgrade Checkstyle can be completed, what mitigations can I take?
Can I create some kind of finalizer task that inspects the state of the checkstyleMain
and checkstyleTest
tasks and, if the problem was that ‘Got an exception - null’ do something like ignore the failure or re-run those tasks?
More generally, what steps can be taken to mitigate the intermittent failures of a flaky, crash-prone task?