One convenient way to use Maven is to use jetty plugin to run web projects. Only Maven jetty: Run can run the WEB Project. Most of the time, we need to debug it in IDE. So how can I debug a web project using jetty Plugin in eclipse?
Next we will configure it.
- First, choose run> externel tools> open externel tools.
Dialog .. open the configuration dialog box, select the program node on the left, right-click New, and enter name information in the configuration on the right. In Main
Select the full path of your Maven executable file (eg:/home/Rory/apps/apache-maven-2.0.8/bin
/MVN), Working
Directory select your Maven Project (eg: $ {workspace_loc:/guice-example}), enter
Jetty: Run. Then switch to the Environment tab. New variable, name is
MAVEN_OPTS
Value is
-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y
OK. This step is complete. Apply and close.
- Connect
Next, add a debug, Open Run-> open debug dialog .. open the debug dialog window, and select the remote
Java application, right-click New and enter name. Select the project connection to be debugged in the project.
Set "host" in properties to localhost, "Port" to "4000" configured above, and then apply.
- Next we can start debugging. Start the externel tools configuration in step 1, and then run debug in step 2. You can see that the console has the output of MVN jetty: Run. Next, let's start debugging your project. :)