Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Intellij to set breakpoints in gradle project

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 and choosing to debug it, and setting GRADLE_OPTS environment variables as suggested in this answer:

Debug Gradle plugins with IntelliJ

and attaching the debugger remotely, which works fine, but neither one breaks on the breakpoints. I must be missing something.

like image 441
psugar Avatar asked Jun 18 '13 22:06

psugar


1 Answers

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.

like image 84
ceilfors Avatar answered Oct 04 '22 02:10

ceilfors