How to debug mvn jetty:run in Eclipse 使用mvn jetty:run命令时,在eclipse中如何配置debug
http://1985wanggang.blog.163.com/blog/static/776383320120384555181/
打开eclipse,
Run/External Tools/External Tools …”
1.点击Run工具栏
2.打开/External Tools配置项
3.加入一条配置,如图所示:
4.增加环境变量。
4.打开debug配置项,如图所示
5.选择remote java application,点击新建按钮,配置项如图所示:
运行命令启动jetty服务:
1.运行自定义的jetty服务
2.启动debug
启动后的图示
注:也可以在电脑的系统环境变量中,配置mvn的环境变量,不过没有这样灵活,可以在eclipse运行程序,将控制台输出到eclipse的界面中
================================================================
参考:
How to debug mvn jetty:run in Eclipse
原文链接:http://simile.mit.edu/wiki/How_to_debug_mvn_jetty:run_in_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.
[ edit]
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.
还没有评论,来说两句吧...