How to debug gradle test execution of my project?

I'm trying to debug some classes while tests is running, but when I execute the run configuration in debug mode no breakpoints are reached. Asking on gradle mailing list I found the option to start the jvm in debug mode:


test.doFirst {
    jvmArgs '-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005'

But event with this option I can't get the debug to work. This is the run configuration I'm using:
Captura de tela 2010-04-13 às 11.02.32.png

And the output when I try to debug is:

/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=,suspend=y,server=n -Dgradle.home=/Users/felipecypriano/java-utils/gradle-0.9-preview-1 -Dtools.jar=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/tools.jar -javaagent:/Applications/ -Dfile.encoding=UTF-8 -classpath /Users/felipecypriano/java-utils/gradle-0.9-preview-1/lib/groovy-all-1.7.1.jar:/Users/felipecypriano/java-utils/gradle-0.9-preview-1/lib/gradle-core-0.9-preview-1.jar:/Users/felipecypriano/java-utils/gradle-0.9-preview-1/lib/gradle-core-worker-0.9-preview-1.jar:/Users/felipecypriano/java-utils/gradle-0.9-preview-1/lib/gradle-launcher-0.9-preview-1.jar:/Users/felipecypriano/java-utils/gradle-0.9-preview-1/lib/gradle-open-api-0.9-preview-1.jar:/Users/felipecypriano/java-utils/gradle-0.9-preview-1/lib/gradle-ui-0.9-preview-1.jar:/Applications/ org.gradle.launcher.GradleMain --build-file /Users/felipecypriano/dev/GitClones/vc-patrus-integration/build.gradle test
Connected to the target VM, address: '', transport: 'socket'
# omitted
:processTestResources UP-TO-DATE
Listening for transport dt_socket at address: 5005
# omitted

Total time: 15.56 secs
Disconnected from the target VM, address: '', transport: 'socket'

How could I make it work?

Comment actions Permalink

So, any ideas? I really need this.

Comment actions Permalink

Apparently Gradle starts another debug process with the parameters you
specify. Therefore you should use a remote debug configuration. You can
set suspend=y and create a Remote configuration to localhost:5005. After
your script starts the tests, their process will be suspended until you
connect to it via the Remote configuration. After that you can debug as

Comment actions Permalink

That's very strange, because NetBeans can run tests using Gradle and even launching them with remote debugger automatically (no configuration from user is required)

Comment actions Permalink

What's strange? Did you tried IJ 13?


Please sign in to leave a comment.