首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

在eclipse中筹建appfuse工程调试环境

2012-10-25 
在eclipse中搭建appfuse工程调试环境假定你已经用mvn生成好了appfuse工程Debugging with the Maven Jetty

在eclipse中搭建appfuse工程调试环境

假定你已经用mvn生成好了appfuse工程

Debugging with the Maven Jetty Plugin 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 jetty: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.

From instructions provided by Rolf Strijdhorst on the Maven mailing list

Stopping Jetty

In order to stop the jetty server the "Allow termination of remote VM" should be checked in debug dialog in Step 2. When you have the jetty server running and the debugger connected you can switch to the debug perspective. In the debug view, right click on the Java HotSpot(TM) Client VM[localhost:4000] and  chose terminate. This will stop the debugger and the jetty server.


懒得翻译了,大家看一下。刚实验过 完全可以的,而且不需要myeclipse的支持,完全用mvn搞定。
来源:http://docs.codehaus.org/display/JETTY/Debugging+with+the+Maven+Jetty+Plugin+inside+Eclipse 1 楼 zhangwusheng 2008-06-11   为什么我按照一步一步来的时候,(我的第一步骤配置的名称叫appfuse)在最后调试的时候, run->external tools->appfuse 报错:
The working directory J:\appfuse_eclipse\mycms does not exist for the external tool named appfuse.


我的location配置的是mvn。bat的目录:
D:\source\java\apache\apache-maven-2.0.9\bin\mvn.bat
working directory配置的是J:\appfuse_eclipse\mycms
,因为我生成的project就是叫mycms。


各位看看怎么回事?

热点排行