# What is the best way to debug gradle plugins?

**URL:** <https://discuss.gradle.org/t/what-is-the-best-way-to-debug-gradle-plugins/21509>\
**Category:** Help/Discuss\
**Created:** [February 8, 2017, 7:26pm UTC](https://discuss.gradle.org/t/what-is-the-best-way-to-debug-gradle-plugins/21509 "2017-02-08T19:26:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![venslens](https://avatars.discourse-cdn.com/v4/letter/v/97f17d/32.png) [@venslens](https://discuss.gradle.org/u/venslens)\
**Post date:** [February 8, 2017, 7:26pm UTC](https://discuss.gradle.org/t/what-is-the-best-way-to-debug-gradle-plugins/21509/1 "2017-02-08T19:26:58Z")

</div>

New to gradle and this forum.

What is the best way to debug the groovy/java code in the plugin class (ex: class TestPlugin implements Plugin)  
I have been using prinln - but wondering if there is a better way to debug it line by line ?

---

<div class="post-metadata">

**Author:** ![bmuschko](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/bmuschko/32/5458_2.png) [@bmuschko](https://discuss.gradle.org/u/bmuschko)\
**Post date:** [February 9, 2017, 1:46pm UTC](https://discuss.gradle.org/t/what-is-the-best-way-to-debug-gradle-plugins/21509/2 "2017-02-09T13:46:49Z")

</div>

You can remote debug your Gradle build as described here:

> [@How do you attach a debugger to gradle so that I can debug it running a task?](https://discuss.gradle.org/t/how-do-you-attach-a-debugger-to-gradle-so-that-i-can-debug-it-running-a-task/7526/12):
>
> Some more information on this would definitely be helpful. I’ve mad mixed results with eclipse & gradle so far. I have been able to debug java/groovy that’s being called from gradle when running on anther system and using eclipse’s remote java app debug config combined with the GRADLE\_OPTS="-Xdebug -Xrunjdwp:transport=dt\_socket,server=y,suspend=y,address=5006" Note that this needs to be set in the env, it’s not picked up from ~/.gradle/gradle.properties as documented. Maybe I’m doing somethin…

Make sure to also use the option `--no-daemon`.

---

<div class="post-metadata">

**Author:** ![ZillaG](https://avatars.discourse-cdn.com/v4/letter/z/ed655f/32.png) [@ZillaG](https://discuss.gradle.org/u/ZillaG)\
**Post date:** [March 3, 2020, 4:20am UTC](https://discuss.gradle.org/t/what-is-the-best-way-to-debug-gradle-plugins/21509/3 "2020-03-03T04:20:04Z")

</div>

I’m new to Gradle plugins too, and Java. But [How to debug Gradle Plugins with IntelliJ](https://medium.com/grandcentrix/how-to-debug-gradle-plugins-with-intellij-eef2ef681a7b) helped.
