Is it possible to debug a gradle test started with
gradle test
on CLI from within eclipse? Can I add the JVM args like
java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 ....
for remote debugging as I would do it for a normal Java program?
I prefer gradle test --debug-jvm
. This starts the application in remote debug mode, and you can attach with any remote debugger, e.g., Eclipse, on port 5005
.
This does not only work for JUnit tests, but also for normal program executions, i.e., gradle run --debug-jvm
.
In Eclipse, go on your Project -> Debug as... -> Debug Configuration -> Remote Java Application. As host set localhost
, as port 5005
.
Then you should be able to debug your tests.
For more information see the official Gradle Java plugin doc regarding testing.
[...] can also be enabled at invocation time via the --debug-jvm task option (since Gradle 1.12).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With