Using Intellij to set breakpoints in gradle project

后端 未结 2 782
没有蜡笔的小新
没有蜡笔的小新 2021-01-12 12:33

Now that IntelliJ 12.1 is out, I was hoping to be able to attach the debugger to a \'gradle run\' app and have it stop at breakpoints. I\'ve tried both right-clicking run a

相关标签:
2条回答
  • 2021-01-12 13:13

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

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

    and debug properties:

    run {
        debug true
    }
    

    Right clicking to debug doesn't seem to work because IntelliJ is attaching the debugger to the wrong JVM i.e. gradle.

    0 讨论(0)
  • 2021-01-12 13:16

    I can debug normally. I only can't debug if I use the gradle daemon ("--daemon" option).

    0 讨论(0)
提交回复
热议问题