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:

build.gradle

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=127.0.0.1:52786,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/Maia-IU-95.24.app/plugins/GroovyHotSwap/lib/agent/gragent.jar -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/Maia-IU-95.24.app/lib/idea_rt.jar org.gradle.launcher.GradleMain --build-file /Users/felipecypriano/dev/GitClones/vc-patrus-integration/build.gradle test
Connected to the target VM, address: '127.0.0.1:52786', transport: 'socket'
# omitted
:compileTestGroovy
:processTestResources UP-TO-DATE
:testClasses
:test
Listening for transport dt_socket at address: 5005
# omitted

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


How could I make it work?

0
Avatar
Permanently deleted user

So, any ideas? I really need this.

0

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
usual.

0

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)

0

What's strange? Did you tried IJ 13?

0

请先登录再写评论。