Gradle has support for PMD. You can find following example on internet:
apply plugin: 'pmd' pmdMain { ruleSets = [ "basic", "strings" ] }
This code is not working with Gradle 2.0. Here is error message:
:clean :pmdMain FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':pmdMain'. Can't find resource null. Make sure the resource is a valid file or URL and is on the CLASSPATH. Here's the current classpath: C:\Users\georgik\tmp\install\gradle-2.0\lib\gradle-launcher-2.0.jar
The reason is simple. In case of Gradle 2.0 you must add language prefix before name of rule. You must use java-strings instead of plain strings.
Here is correct example (available also on YSoftDevs Github):
apply plugin: 'pmd' pmdMain { ruleSets = [ "java-basic", "java-strings", "java-braces" ] }
You can find more rules for PMD in official documentation.
Thanks Matt Sicker for correct solution.
Nice one – the null error did not really point towards this. Thanx for this – just made my day a lot better!
Thank you a lot for solution
The same! Thanks a lot of revealing source of problem