How do i debug a web application running on jetty in eclipse?

I would run the application with maven using the command: mvnDebug jetty:run

And setup a remote Java application using port 8000, in Eclipse IDE.

See the 'Setting up Maven 2.0.8+' section of: http://docs.codehaus.org/display/MAVENUSER/Dealing+with+Eclipse-based+IDE


None of the answers worked for me. Here's what did work:

  • Create Maven Eclipse Runtime for your project:
  • right-click on project -> maven build -> goals: jetty:run
  • go to JRE tab of your Maven Eclipse Runtime, and in the VM arguments section add:

-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

When you execute this runtime, the first thing the Eclipse console outputs (in blue) is:

Listening for transport dt_socket at address: 8000

Now you can create a Remote Java application Debug Runtime and connect to the debug port (8000 in this example)


Click External Tools Config,

enter image description here

Select program and click the new button top left. Set location to your maven binary working directory to local workspace and arguments to jetty:run enter image description here

In the environment tab set the maven opts. Notice socket address = 4000 and suspend=y enter image description here

The go to debug configurations and add a new remote application. Add a project name and set the socket address. Now run the External tool it should say:

Listening for transport dt_socket at address: 4000

Then you can debug the remote app and add breakpoints etc.

enter image description hereenter image description here