Even though the accepted answer should work, you can achieve it in a much easier way.
-
Just run
gradle run --debug-jvm
. This starts the application in remote debug mode, and you can attach with any remote debugger, e.g., Eclipse, on port5005
. -
Assuming you use Eclipse as IDE: In Eclipse, go on your Project -> Debug as… -> Debug Configuration -> Remote Java Application. As host set
localhost
, as port5005
, and you are free to go.
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).