# Gradle PMD plugin should support auxclasspath

**URL:** <https://discuss.gradle.org/t/gradle-pmd-plugin-should-support-auxclasspath/10499>\
**Category:** Bugs\
**Tags:** plugins\
**Created:** [July 8, 2015, 6:00pm UTC](https://discuss.gradle.org/t/gradle-pmd-plugin-should-support-auxclasspath/10499 "2015-07-08T18:00:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsotuyod](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/jsotuyod/32/2539_2.png) [@jsotuyod](https://discuss.gradle.org/u/jsotuyod)\
**Post date:** [July 8, 2015, 6:00pm UTC](https://discuss.gradle.org/t/gradle-pmd-plugin-should-support-auxclasspath/10499/1 "2015-07-08T18:00:15Z")

</div>

> [@Request for gradle pmd plugin to support auxclasspath](https://discuss.gradle.org/t/request-for-gradle-pmd-plugin-to-support-auxclasspath/931):
>
> I need to use auxclasspath just like pmd ant task. See [http://pmd.sourceforge.net/pmd-5.1.0/ant-task.html](http://pmd.sourceforge.net/pmd-5.1.0/ant-task.html). Can this be supported?

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](http://pmd.sourceforge.net/pmd-5.3.2/pmd-java/rules/java/android.html):

> 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.

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [July 13, 2015, 4:31am UTC](https://discuss.gradle.org/t/gradle-pmd-plugin-should-support-auxclasspath/10499/2 "2015-07-13T04:31:26Z")

</div>

> [@jsotuyod](#):
>
> The Android rules for PMD need the auxclasspath to be able to correctly detect types.

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

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [July 13, 2015, 4:33am UTC](https://discuss.gradle.org/t/gradle-pmd-plugin-should-support-auxclasspath/10499/3 "2015-07-13T04:33:39Z")

</div>

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](https://github.com/gradle/gradle/blob/master/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/Pmd.groovy#L45-45)

---

<div class="post-metadata">

**Author:** ![jsotuyod](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/jsotuyod/32/2539_2.png) [@jsotuyod](https://discuss.gradle.org/u/jsotuyod)\
**Post date:** [July 13, 2015, 12:07pm UTC](https://discuss.gradle.org/t/gradle-pmd-plugin-should-support-auxclasspath/10499/4 "2015-07-13T12:07:45Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![jsotuyod](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/jsotuyod/32/2539_2.png) [@jsotuyod](https://discuss.gradle.org/u/jsotuyod)\
**Post date:** [July 13, 2015, 12:09pm UTC](https://discuss.gradle.org/t/gradle-pmd-plugin-should-support-auxclasspath/10499/5 "2015-07-13T12:09:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jsotuyod](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/jsotuyod/32/2539_2.png) [@jsotuyod](https://discuss.gradle.org/u/jsotuyod)\
**Post date:** [July 20, 2015, 9:09pm UTC](https://discuss.gradle.org/t/gradle-pmd-plugin-should-support-auxclasspath/10499/6 "2015-07-20T21:09:04Z")

</div>

Done! [https://github.com/gradle/gradle/pull/482](https://github.com/gradle/gradle/pull/482)

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [July 21, 2015, 3:52am UTC](https://discuss.gradle.org/t/gradle-pmd-plugin-should-support-auxclasspath/10499/7 "2015-07-21T03:52:27Z")

</div>

Thanks for the contribution Juan!
