Checkstyle plugin dependencies


(Nicolas PIEGAY) #1

Hello,

I’d like to use checkstyle on my project but i did not manage to make it work. java.lang.ClassNotFoundException: com.puppycrawl.tools.checkstyle.CheckStyleTask

I think i have a dependency issue. I don’t use a maven repo, just a simple local lib directory. This is an extract of the depencies declaration : dependencies {

compile…etc

findbugs files("${project.root}/lib/findbugs-2.0.2/lib/findbugs.jar")

checkstyle files("${project.root}/lib/checkstyle-5.5.jar") }

Any idea to make it work ? Thank you for your help, Nicolas


(Peter Niederwieser) #2

What’s ‘project.root’? I’m not aware of such a property in the Gradle API. Do you mean ‘project.rootDir’?


(Nicolas PIEGAY) #3

Yes, it is the same thing. I have compile dependencies and the above findbugs dependency thats works. I checked in the jar and i could find the CheckStyleTask. Is there something wrong with my dependency declaration ?


(Peter Niederwieser) #4

I assume you are akready applying the ‘checkstyle’ plugin. In that case, my best guess it that the path to the Checkstyle Jar is incorrect. Try this:

task verify << {

assert configurations.checkstyle.singleFile.isFile()

}

Also, which Gradle version are you using?