How to run Jetty via Gradle in Debug Mode

JARC picture JARC · Feb 16, 2012 · Viewed 33.8k times · Source

Does anyone know how to configure the jetty gradle plugin to run in debug mode so that I can attach a remote debugger?

I've tried setting the gradle and java opts to:

-Xdebug -Xrunjdwp:transport=dt_socket,address=9999,server=y,suspend=n

...but it doesn't seem to work.

I'm able to get my own jetty installation working fine, just not via gradle (jettyRun or jettyRunWar).

Regards.

Answer

Luis Ramirez-Monterosa picture Luis Ramirez-Monterosa · Mar 10, 2012

On Linux:

export GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=9999,server=y,suspend=n"
gradle jettyRun

On Windows:

set GRADLE_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=9999,server=y,suspend=‌​n
gradle jettyRun