How to find which checkstyle version gradle is using?
There are three ways I can think of right now, least attractive first:
- You can look into the Gradle source code.
- You can check the Checkstyle Compatibility Matrix (column L, yellow cells).
Both say that from Gradle 3.3 onwards, the default Checkstyle version is 6.19; before, it was 5.9. Only Gradle versions prior to 2.4 used even older versions of Checkstyle. But the recommended way is to choose the Checkstyle version explicitly, by specifying it in your build.gradle file:
checkstyle { configFile file('your/checkstyle.xml'); toolVersion '8.2'; // your choice here }
This is better than relying on the default version, because you can use much newer versions of Checkstyle, and your Checkstyle setup won't break when you update Gradle.
You can check the current value of checkstyle.toolVersion
by writing this in your build.gradle file and reloading your gradle project
plugins {
id 'java'
id 'checkstyle'
}
println checkstyle.toolVersion