Archive for the 'maven' Category

Debugging with the Maven Jetty Plugin in Eclipse

May 15th, 2007 by Pascal Alberty

You use Maven and Jetty to test your Web Application and want to debug it under Eclipse, you can proceed like this:

Configuring
Step 1: Configure JVM debug mode
In mvn.bat file, remove REM from the following line:
@REM set MAVEN_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000

Supplying suspend=n instead of suspend=y allows you to start jetty without debugger. Then, you can launch it when you want.

Step 1 bis
In the maven bin directory, you can create a command file named jetty.bat with the following lines

@set MAVEN_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
mvn clean jetty:run

Step 2: Configure Remote Application in Eclipse
Run/Debug…/Remote Application, right click, new and OK

Lauching
Step 1: Launch jetty in debug mode
By launching the following command in a command window:
mvn clean jetty:run

Step 1bis:
By launching the following command in a command window:
jetty

Step 2: Launch debugger in Eclipse
Launch Remote Application in debug mode

That’s all !