How to debug mvn jetty:run in Eclipse 使用mvn jetty:run命令时,在eclipse中如何配置debug

左手的ㄟ右手 2022-08-23 14:58 270阅读 0赞

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 - 和申 - 和申的个人主页

2.打开/External Tools配置项

How to debug mvn jetty:run in Eclipse  使用mvn jetty:run命令时,在eclipse中如何配置debug - 和申 - 和申的个人主页

3.加入一条配置,如图所示:

How to debug mvn jetty:run in Eclipse  使用mvn jetty:run命令时,在eclipse中如何配置debug - 和申 - 和申的个人主页

4.增加环境变量。

How to debug mvn jetty:run in Eclipse  使用mvn jetty:run命令时,在eclipse中如何配置debug - 和申 - 和申的个人主页

4.打开debug配置项,如图所示

How to debug mvn jetty:run in Eclipse  使用mvn jetty:run命令时,在eclipse中如何配置debug - 和申 - 和申的个人主页

5.选择remote java application,点击新建按钮,配置项如图所示:

How to debug mvn jetty:run in Eclipse  使用mvn jetty:run命令时,在eclipse中如何配置debug - 和申 - 和申的个人主页

运行命令启动jetty服务:

1.运行自定义的jetty服务

How to debug mvn jetty:run in Eclipse  使用mvn jetty:run命令时,在eclipse中如何配置debug - 和申 - 和申的个人主页

2.启动debug

How to debug mvn jetty:run in Eclipse  使用mvn jetty:run命令时,在eclipse中如何配置debug - 和申 - 和申的个人主页

启动后的图示

How to debug mvn jetty:run in Eclipse  使用mvn jetty:run命令时,在eclipse中如何配置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.

发表评论

表情:
评论列表 (有 0 条评论,270人围观)

还没有评论,来说两句吧...

相关阅读

    相关 eclipse断点调试debug

    几乎没有用过debug模式,每次想要知道结果都是sysou一下。记得曾经问乱码问题,jfinal说打断点调试看在哪里出错。简单记下普通调试。 1.在需要查看的地方打断点,方法