Building Dynamic Web Engineering with MAVEN

Source: Internet
Author: User
Tags apache tomcat

Today I want to talk about Maven. It's a very powerful tool. If you know how to use it, you will have the least amount of energy to get the most results. Typically maven helps you manage your projects, including relying on libraries, building processes, etc... But this article will show you how to create a Dynamic Web project (in Eclipse IDE) with Maven.

Pre-Preparation:

Eclipse IDE for Java EE developers
M2E Plugin for Eclipse
Maven

1. File > New (alt+shift+n) > Dynamic Web Project

Enter the name of the project after "project name" (for example: MAVENDWP);
In "Target runtime" Select a We server (I use Apache Tomcat 7.0);
Click on the "Next" button;
Create the directory structure shown (take a closer look at this directory structure.) He is an important detail in creating a Dynamic Web project):



Click on the "Next" button;
Select the Generate Web. XML Deployment descriptor check box;
Click the "Finish" button.



2. Right-click Engineering > Configure > Convert to Maven Project

Select "Packaging" as the war;
Click "Finish" button;
After that, Pom.xml will appear in the structure of the project;
Move all directories under the WebContent folder to Src/main/webapp;
WebContent This file directory can be deleted.

3. Open the project's root directory

Run this command in cmd: mvn eclipse:eclipse-dwtpversion=2.0
This command will generate a configuration about eclipse (. Classpath,. Project, etc.)
Right-click the Src/main/webapp folder: Build Path > Use as Source folder (this point is actual only if Src/main/webapp disappeared from The source folders)

This is the final directory structure of a dynamic Web project created with Maven:



I hope this article is described clearly enough so that you can follow the above description without any problems in building your own project. I will try to answer every question in the comments.

Original link: http://fruzenshtein.com/setup-of-dynamic-web-project-using-maven/

Building Dynamic Web Engineering with MAVEN

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.