Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Jetty via Gradle in Debug Mode

Tags:

gradle

jetty

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.

like image 479
JARC Avatar asked Feb 16 '12 16:02

JARC


People also ask

How do I debug a gradle project in Eclipse?

Open Eclipse and go to Run -> Debug Configurations.... Select the Remote Java Application in the list of configuration types on the left. Click the New toolbar button. In the Project field of the Connect tab, type or browse to select the project to use as a reference for the launch (for source lookup).


2 Answers

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 
like image 69
Luis Ramirez-Monterosa Avatar answered Nov 23 '22 05:11

Luis Ramirez-Monterosa


Try using Gretty plugin, it provided gradle tasks jettyRunDebug, jettyStartDebug etc.

Source code and doc: https://github.com/akhikhl/gretty

Disclosure: I am author of Gretty plugin.

like image 44
akhikhl Avatar answered Nov 23 '22 04:11

akhikhl