Problem Background:
Eclipse uses eclipse-jee-indigo-SR1-win32, Maven uses 3.0.3, using m2e plug-in eclipse, eclipse and Maven integration.
Maven is used to create webapps, compile, test, package, and deploy them. Many functions of eclipse are replaced by Maven, so I am glad that I can finally get rid of Eclipse, then the nightmare is coming ......
Maven cannot debug webapp!
Solution:
After consulting a friend, I learned that WTP can be used for debugging. The first time I heard that Google found a Baidu document ......
Http://wenku.baidu.com/view/4e0a3b1614791711cc79171d.html
It is still detailed, but it is found that, in actual operations, when deploying the webapp created by Maven to the server in eclipse, there is no such project! It seems that the WTP server does not recognize the webapp created by Maven ......
After a burst of chaos, a miracle occurred.
Right-click the target server in the servers window = open
Select the modules Tab
Add external web module
Do you know what to do?
Browse, find the webapp created by your Maven, and locate the target/$ {finalname} folder, because the content in this folder is finally deployed on the server.
Then modify the path, which will affect the URL when you access it through the browser. Generally, $ {finalname} is written, right?
Save it.
Now you can find a line in servlet or other Java code, set a breakpoint, and debug the target server in the servers window (right-click the target server and choose = "debug ), then access your website through a browser, and try to trigger a request to the servlet or other background Java code. Then you will find eclipse asking you if you are in the debugging status, of course, select "yes ~
Then start debugging ~
If you are prompted that the source code cannot be found and the Code cannot be displayed, click Edit source lookup path, add, add a Java project, and find your Maven project, you do not need to go to the src/Java directory (I have added the directory before, so I will not add it now). Do you know how to add it? Check and OK ......