Debug Java program by executing “gradle run”

Even though the accepted answer should work, you can achieve it in a much easier way.


  1. 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 port 5005.

  2. Assuming you use Eclipse as IDE: In Eclipse, go on your Project -> Debug as… -> Debug Configuration -> Remote Java Application. As host set localhost, as port 5005, 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).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)