I have googled and found few old ways to debug gradle script (stopping on breakpoints) from the intellij.
However time has passed and I was wondering if there is an easier way to stop on breakpoints for debugging gradle script in IntelliJ IDEA 2016.1.1?
I also got confused with the different tutorials, and couldn’t find an easy cookbook tutorial on "how to stop on breakpoint in gradle script using intellij"
You can put breakpoints in a task or a plugin, but not in your build scripts.
It takes some getting used to, but these days if I need to put a breakpoint in the build script, I take it as a “code smell” that my build is not declarative and I need to extract the imperative logic to a task or a plugin.
The easiest thing is to copy/paste the code in buildSrc and reference it from there. Then you can set your breakpoints, and attach your IDE on port 5005 after running Gradle like this:
Nothing works tried debugging in Eclipse IntelliJ, but no success.
My build.gradle is quite complex. Reading multiple post it looks like we can’t add breakpoints in build.gradle which is fine.
But I have multiple tasks in build.gradle of different types (Test, Exec etc…). Test type tasks invoke TestNG tests calling testing.xml.
I spend last two days trying to bebug my java code using remote, TestNG and simple gradle run configurations. But it never stops at breakpoints. Where I can find some good info.