Use Maven to create and manage J2EE website projects in eclipse

Source: Internet
Author: User

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 ......

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.