Remote debug not working with "gradle jettyRunWar"

I’m using gradle 1.8 to build a standard web-app (has to be 1.8 as I also use gradle for Android which insists on 1.8).

I had gradle run my app configured for remote debug with the usual

GRADLE_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" gradle jettyRunWar

All seemed normal, with this message in the app output:

Listening for transport dt_socket at address: 5005

and Intellij connected no problem to the remote app debug. However with the gradle daemon mode enabled the breakpoints (in Intellij 13) did not fire. If I disable the gradle daemon and restart the app with just

gradle jettyRunWar

the breakpoints work fine.

To set remote debugging options for the daemon you’ll have to use org.gradle.jvmargs. Here’s an example that sets the property on the command line:

gradle -Dorg.gradle.jvmargs="-XX:MaxPermSize=256M -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005" jettyRunWar

Of course you can also move the property into “”.