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

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

DebuggingwiththeMavenJettyPlugininEclipse

Step1

GototheRun/ExternalTools/ExternalTools..."menuitemonthe"Run"menubar.Select"Program"andclickthe"New"button.Onthe"Main"tab,fillinthe"Location:"asthefullpathtoyour"mvn"executable.Forthe"WorkingDirectory:"selecttheworkspacethatmatchesyourwebapp.For"Arguments:"addjetty:run.

Movetothe"Environment"tabandclickthe"New"buttontoaddanewvariablenamedMAVEN_OPTSwiththevalue:

-Xdebug-Xnoagent-Djava.compiler=NONE-Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y

Ifyousupplysuspend=ninsteadofsuspend=yyoucanstartimmediatelywithoutrunningthedebuggerandlaunchthedebuggeratanytimeyoureallywishtodebug.

Step2

Then,pullupthe"Run/Debug/Debug..."menuitemandselect"RemoteJavaApplication"andclickthe"New"button.Fillinthedialogbyselectingyourwebappprojectforthe"Project:"field,andensureyouareusingthesameportnumberasyouspecifiedintheaddress=propertyabove.

NowallyouneedtodoistoRun/ExternalToolsandselectthenameofthemaventoolsetupyoucreatedinstep1tostartthepluginandthenRun/Debugandselectthenameofthedebugsetupyousetupinstep2.

FrominstructionsprovidedbyRolfStrijdhorstontheMavenmailinglist

StoppingJetty

Inordertostopthejettyserverthe"AllowterminationofremoteVM"shouldbecheckedindebugdialoginStep2.Whenyouhavethejettyserverrunningandthedebuggerconnectedyoucanswitchtothedebugperspective.Inthedebugview,rightclickontheJavaHotSpot(TM)ClientVM[localhost:4000]andchoseterminate.Thiswillstopthedebuggerandthejettyserver.

懒得翻译了,大家看一下。刚实验过完全可以的,而且不需要myeclipse的支持,完全用mvn搞定。

来源:http://docs.codehaus.org/display/JETTY/Debugging+with+the+Maven+Jetty+Plugin+inside+Eclipse

相关推荐