Java – use IntelliJ to set breakpoints in gradle projects

Now that IntelliJ 12.1 is out, I want to be able to attach the debugger to the 'gradle run' application and stop it at the breakpoint I've tried to right-click run and select debug it, and set grade as recommended in this answer_ Opts environment variable:

Debug Gradle plugins with IntelliJ

The debugger is connected remotely and works normally, but there is no breakpoint I must have missed something

Solution

I can debug remotely by configuring running tasks Since it is a javaexec task, it supports the jvmargs attribute:

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

And debug properties:

run {
    debug true
}

Right click debugging doesn't seem to work because IntelliJ attaches the debugger to the wrong JVM, gradle

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>