Debug Servlet Webapp deployed to Jetty using Maven and Eclipse

This is a guide for the Eclipse configurations in order to debug a webapp deployed to Jetty introduced as a Maven plugin. The setup has been described to this article.

Since we don’t use the Eclipse WTP tooling system to our advantage, there is a bit of manual work so that to setup the parameters and debug the webapp remotely.

First we need to setup the maven goal:

mvn jetty:run

to be remote debugging-aware. To do so we go to “External Tools > External Tools Configuration”, creating a new configuration setting and setting the “Location:” section to the full path of the

mvn

executable. The “Working Directory” needs to point to our Eclipse project. As an argument we are setting:

jetty:run

Finally in the “Environment” tab we need to setup the followings as variable/value:

MAVEN_OPTS / -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y

 

Finally we need to setup a new “Debug > Debug Configurations.. > Remote Java Application” configuration setting, pointing to our project and making sure the port is set to 4000 to match the setting we’ve specified above.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s