Gradle PMD plugin should support auxclasspath

I believe this is a big issue. The Android rules for PMD need the auxclasspath to be able to correctly detect types. As stated in the docs:

To get better results, make sure that the auxclasspath is defined for type resolution to work.

Since Android has officially moved to Gradle for build automation, not being able to use it from Gradle forces developers to use PMD as stand alone.

What does this need to be set to in the Android case?

This looks like it would be quite simple to add, making it a good candidate for contribution. The existing support for classpath effectively just needs to be duplicated for the “auxclasspath”. That is, duplicating properties such as https://github.com/gradle/gradle/blob/master/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/Pmd.groovy#L45-45

For PMD, all libraries (Android’s compile classpath for the given build type) + a mockable-android-#.jar to be able to see android SDK’s classes.

Actually, it’s the exact same thing as needed for Findbugs to work properly on Android without reporting missing classes (Findbugs plugin DOES include the auxclasspath property).

Thanks… if I have some spare time I’ll check the contribution guidelines and submit a PR for this.

Done! https://github.com/gradle/gradle/pull/482

Thanks for the contribution Juan!