Eclipse: running your project via mvn jetty:run and debugging it
As part of my preparation for my new assignment, since I’ve been using Eclipse, I do really need this set to my IDE…
Step 1
Go to the Run/External Tools/External Tools …” menu item on the “Run” menu bar. Select “Program” and click the “New” button. On the “Main” tab, fill in the “Location:” as the full path to your “mvn” executable. For the “Working Directory:” select the workspace that matches your webapp. For “Arguments:” add jetty6:run.
Move to the “Environment” tab and click the “New” button to add a new variable named MAVEN_OPTS with the value:
-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=yIf you supply suspend=n instead of suspend=y you can start immediately without running the debugger and launch the debugger at anytime you really wish to debug.
Step 2
Then, pull up the “Run/Debug/Debug …” menu item and select “Remote Java Application” and click the “New” button. Fill in the dialog by selecting your webapp project for the “Project:” field, and ensure you are using the same port number as you specified in the address= property above.
Now all you need to do is to Run/External Tools and select the name of the maven tool setup you created in step 1 to start the plugin and then Run/Debug and select the name of the debug setup you setup in step2.
Some Notes:
If your project has a modular structure, you need to set the “Working Directory” on the parent folder and use jetty:run-exploded for the argument field.
Generally, your guide in configuring Step 1 would be how you run your project via command console.
Make sure that you have ran your project in command console just to verify that “mvn jetty:run” or “mvn jetty:run-exploded” is working.
Credits: http://simile.mit.edu/wiki/How_to_debug_mvn_jetty:run_in_Eclipse
- BROWSE / IN TIMELINE
- « Oracle Hibernate URL Connection String
- » Java to DWR - decrease the file size of your javascript
- BROWSE / IN Eclipse
- » Eclipse/maven-jetty plugin: Couldn’t restart my listener
COMMENTS / ONE COMMENT
Julius Cutaran added these pithy words on Mar 08 08 at 4:28 amyou can also increase memory by adding ‘-Xss128k -Xms512m’ to MAVEN_OPTS
SPEAK / ADD YOUR COMMENT
Comments are moderated.
You must be logged in to post a comment.

