In the MAVEN+SPRING+MVC structure, jetty/tomcat How to start a project

Source: Internet
Author: User

For the MAVEN-configured SPRING+MVC project, we are debugging with the Maven jetty and Tomcat plug-in, which is handy. But when it comes to debugging, the Web server that these plug-ins start, it's probably not as simple as how to start and run our project as a Web project. Figuring out how they start up is a reference to our project, that's the purpose.

If the name of the project is MVN_MVC, the entire directory structure is as shown above.

Usually we first generate the red portion of the target directory above with MVN package. Its equivalent execution mvn compile test-compile test war:exploded War:war. That includes compiling, testing, and packaging three steps. We can then use MVN jetty:run or MVN tomcat:run to launch the site and the test runs. This will generate a temporary JSP directory, jetty the corresponding directory name is WORK,TOMCAT directory name is Tomcat.

So, the corresponding directory of the project is the TARGET/MVN_MVC directory.

It's not the same.

The real project directory should be: The Java class for this project comes from the target/classes of the maven configuration of the jar package that this project relies on (and there is no actual physical directory for the MAVEN plug-in dynamic organization management) The configuration files and static resources that this project relies on are derived from the Src/main/webapp

To sum up, you can get two conclusions: runtime, in fact, and TARGET/MVN_MVC this directory (Packaging project directory) has no relationship. So if you modify the dynamic class and static files of this directory during the operation, you will not see the effect. The Src/main/java and Src/main/webapp must be changed. In addition, MAVEN design project idea is: the SRC directory is pure This project code, no temporary files and dependent jar package. This also facilitates the management of the code: you write your own, other people's machines are put elsewhere

If your program is debugging an exception, check it by this method.

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.