http://1985wanggang.blog.163.com/blog/static/776383320120384555181/
打开eclipse,
Run/External Tools/External Tools ..."
1.点击Run工具栏
![How to debug mvn jetty:run in Eclipse 使用mvn jetty:run命令时,在eclipse中如何配置debug - 和申 - 和申的个人主页](http://img4.ph.126.net/M2UhyBZ7kFQ879NOcJ7Wzg==/1006273041757767524.jpg)
![How to debug mvn jetty:run in Eclipse 使用mvn jetty:run命令时,在eclipse中如何配置debug - 和申 - 和申的个人主页](http://img9.ph.126.net/UAhJAYexPHDIv1C9Oux3mA==/1278740819213685679.jpg)
![How to debug mvn jetty:run in Eclipse 使用mvn jetty:run命令时,在eclipse中如何配置debug - 和申 - 和申的个人主页](http://img5.ph.126.net/dCwIxt5L9lX9FIsj0H8iag==/2739595948341999905.jpg)
![How to debug mvn jetty:run in Eclipse 使用mvn jetty:run命令时,在eclipse中如何配置debug - 和申 - 和申的个人主页](http://img2.ph.126.net/EIZfQ2UuXJ41pOS9hXYriw==/1318710265906595322.jpg)
4.打开debug配置项,如图所示
![How to debug mvn jetty:run in Eclipse 使用mvn jetty:run命令时,在eclipse中如何配置debug - 和申 - 和申的个人主页](http://img8.ph.126.net/cqhG_V4QIqaQjf2QHVmIOQ==/2596325185196267708.jpg)
5.选择remote java application,点击新建按钮,配置项如图所示:
![How to debug mvn jetty:run in Eclipse 使用mvn jetty:run命令时,在eclipse中如何配置debug - 和申 - 和申的个人主页](http://img2.ph.126.net/gYc5UiIsw3thI8F-f29lKg==/640918521987342772.jpg)
运行命令启动jetty服务:
1.运行自定义的jetty服务
![How to debug mvn jetty:run in Eclipse 使用mvn jetty:run命令时,在eclipse中如何配置debug - 和申 - 和申的个人主页](http://img8.ph.126.net/YGzzGrv7_JuIQeBiX1Y1lw==/655836695752999838.jpg)
2.启动debug
![How to debug mvn jetty:run in Eclipse 使用mvn jetty:run命令时,在eclipse中如何配置debug - 和申 - 和申的个人主页](http://img2.ph.126.net/WXwcZv3bw-TPabCERYe2Aw==/1103100433746235952.jpg)
启动后的图示
![How to debug mvn jetty:run in Eclipse 使用mvn jetty:run命令时,在eclipse中如何配置debug - 和申 - 和申的个人主页](http://img7.ph.126.net/DdWmr6L3BiSCmgun3Nh2_g==/1103100433746235957.jpg)
注:也可以在电脑的系统环境变量中,配置mvn的环境变量,不过没有这样灵活,可以在eclipse运行程序,将控制台输出到eclipse的界面中
================================================================
================================================================
参考:
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=y
If 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.