The last few days I wrote a couple of Gradle plugins which should simplify our publish process to different repositories. During developing, I ran into issues without knowing their origin. Is the issue part my plugin? Is it a bug inside a plugin which I depend on?

Some default logging parameter by Gradle like --info or --debug are very useful here. But sometimes you need to dig into the real source code to find out what happens.

Thanks to my colleague passsy I found a way to debug Gradle Plugins — and Gradle build scripts if they are written in the Kotlin DSL — with IntelliJ 🎉.

The first thing you have to do is to create a new “Remote Configuration” in IntelliJ. Simply click on the small arrow and choose “Edit configurations…”.

In the opened popup click “Add New Configuration” (the plus symbol at the top left corner) and choose “Remote”.

Give it a name and… you are basically done and are able to debug.