Hi all, Im having some trouble activating checkstyle with the additional sventu checks in my gradle build process. It looks like the build process fails to see my added checks library. Below is the relevant extract of my build script:
:checkstyleMain FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':checkstyleMain'.
> Unable to create a Checker: cannot initialize module TreeWalker - Unable to instantiate AvoidConstantAsFirstOperandInConditionCheck
So it looks like my dependecy is not picked up. It is however in my local repository and the jar does contain the AvoidConstantAsFirstOperandInConditionCheck class.
Im using Gradle 2.4. Any ideas what the problem might be please?
What went wrong:
Execution failed for task ‘:checkstyleMain’.
Unable to create a Checker: cannot initialize module TreeWalker - Unable to instantiate AvoidConstantAsFirstOperandInConditionCheck
This is due to checkstyle not knowing where the custom checks are located in the package. Turns out checkstyle can find this out if you include a checkstyle_packages.xml file in the jar that describes the packages that contains the checks.
Unfortunately there is no such file in com.github.sevntu.checkstyle:sevntu-checks:1.13.4. To get this information, you also need to include “com.github.sevntu.checkstyle:sevntu-checkstyle-maven-plugin:1.13.4”, which basically contains nothing but the checkstyle_packages.xml file.
So I’ve added this to my dependencies and the checkstyle rules finally parses: