Steps for deploying a MAVEN Web project to Tomcat in eclipse

Source: Internet
Author: User

first, build a MAVEN Web project

1, File->new->other

2. Enter the Project Type selection dialog box, for example. We chose Maven->maven Project. Then click on the Next button.

3. Enter the workspace selection dialog box; Location->browse Select a folder as your project workspace, that is, the disk storage location for the new project. Then click on the Next button to proceed to the next step.

4. Enter the MAVEN Project Type selection dialog box, for example.

we chose Artifact ID as Maven-arrchetype-webapp. This type is MAVEN's Web project. Click Next to proceed to the next step.

5. Enter the Project Properties Settings dialog box, such as. Fill in the group ID and artifact ID. Where the artifact ID is displayed as the project name. Click Finish to complete the project new process.

6. Get a MAVEN Web project with the following directory structure.

7, the new MAVEN Web project is not designated Welcome page in the XML, you need to manually add. The additional configuration is as follows.

[HTML] view plaincopy
  1. <! DOCTYPE Web-app Public
  2. "-//sun Microsystems, INC.//DTD Web application 2.3//en"
  3. "Http://java.sun.com/dtd/web-app_2_3.dtd" >
  4.   
  5. web-app >   
  6.   < display-name > archetype created web application </ >
  7.     
  8. <welcome-file-list >
  9.      < welcome-file > </ >
  10. </welcome-file-list >
  11.     
  12. </web-app >

Ii. Configuring the Debug service container in Eclipse

1. Open the Servers view. Window, Show View , other

2. Enter the View selection dialog box, for example. Select Server->servers Click OK to confirm.

3. The servers view is loaded into the console location, such as

4. In Servers view, right click on the mouse and appear as new server floating label. Click Server.

5, enter the container selection and Configuration dialog box, such as. We select Apache->tomcate v6.0 Server and click on the Next button.

6, enter the project Add, remove dialog box, such as. The items shown here are Web projects, and if you do not select the WebApp project for the new MAVEN project, the Mavenweb optional items will not appear in the dialog box.

7. Select the Web project that you want to add to the container, click Add, and go to server. Click Finish to complete the service configuration.

8. After the server configuration is complete, a newly added server, such as. servers, appears in the view.

9, this time the server configuration is basically finished, but if this time to select a service startup, the service started unsuccessfully.

Warning : [Setpropertiesrule]{server/service/engine/host/context} Setting Property ' source ' to ' Org.eclipse.jst.j2ee.server:mavenWeb ' did not ' find a matchingproperty.
10. Double-click the newly added service

11, enter the service configuration interface, such as. Checked: Publish module contexts to separate XML files, saving the configuration in the case of a service stop. Does not stop the service and cannot save the modified. Restart the service and the above warning will not appear.

12, enter the address in the browser: Http://localhost:8080/mavenWeb can see the contents of the home page. Since then, the MAVEN Web project Tomcat Debug environment configuration in Eclipse has been completed.

Three, the principle explanation

in fact, when configuring server in Eclipse, Eclipse will automatically publish the Web project to the workspace:

. metadata\.plugins\org.eclipse.wst.server.core\

in this directory, the specific location of your project is published to this directory depends on the number of servers you have configured. If you have only one server configured in Eclipse, your project will be published to:

. Metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps

you will see that in this directory your project has been posted here. When running server in Eclipse, the code that actually executes is this place.



Steps for deploying a MAVEN Web project to Tomcat in eclipse

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.