Debug gradle itself without rebuilding and attaching

How do I debug Gradle itself?

I got a NPE when converting a maven pom.xml (something like Gradle init gets NPE for complex POM)

I have some ideas what might be the root cause (getLocalRepository() returns null)
But to try a fix, I would like to setup a “debug configuration” in IDEA. I do not want to rebuild everything and than attach to the running process. I just want to be able to change a single line and then click “debug” inside IDEA.

I tried https://dzone.com/articles/debugging-gradle-plugins but that results in an Exception because the classpath is not a jar but a directory and then the process cannot finde gradle-wrapper.properties.