Maven Jetty Remote Debugger

We’re using the Maven Jetty app server for rapid development on the eReferral project. See BC’s intial post on using Jetty. You can attach a remote debugger to Jetty by setting MAVEN_OPTS at the command-line as follows.

C:\ereferrals\workspace\ereferral>set MAVEN_OPTS=-Xmx1000m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n

C:\ereferrals\workspace\ereferral>echo %MAVEN_OPTS%
-Xmx1000m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n

C:\ereferrals\workspace\ereferral>mvn org.mortbay.jetty:maven-jetty-plugin:run
Listening for transport dt_socket at address: 4000
[INFO] Scanning for projects...
[INFO] artifact org.mortbay.jetty:maven-jetty-plugin: checking for updates from
WAGON_VERSION: 1.0-beta-1

and then in eclipse under the Debug menu -> Debug… -> Remote Java Application do as follows (see image).

It's only fair to share...
Share on FacebookGoogle+Tweet about this on TwitterShare on LinkedIn

Leave a Reply