Using Intellij to set breakpoints in a gradle project

Now that IntelliJ 12.1 is out, I was hoping I could hook up the debugger to the gradle run application and stop it at breakpoints. I tried both right-clicking, and choosing to debug it, and setting GRADLE_OPTS environment variables, as suggested in this answer:

Debugging Gradle Plugins with IntelliJ

and remotely debug a debugger that works great, but none break breakpoints. Something is missing for me.

+6
source share
2 answers

I can debug remotely by configuring the run task. Since this is a JavaExec task, it supports the jvmArgs properties:

 run { jvmArgs "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005" } 

and debugging properties:

 run { debug true } 

Right-clicking for debugging does not work, because IntelliJ is attaching the debugger to the wrong JVM ie gradle.

+11
source

I can debug normally. I cannot debug if I use the gradle daemon ("--daemon").

+1
source

Source: https://habr.com/ru/post/947599/


All Articles