How to build a Web project using Maven

Source: Internet
Author: User

Blog Park has been registered for more than 20 days, has not written a blog, today to send an article, but also easy to find notes behind.

I personally have been doing Java Web development for several years, because the company is a business-oriented company, with a number of old stable technology, rarely touch the slightly new point of content,

After several years of behind, their technical ability has begun to slowly be eliminated by the trend of the times. In order to survive in the big wave of sand, I want to good refueling, starting from the basic content, steady precipitation, update their own technology library.

Do not ask for a bite to eat a big fat, only a little progress every day.

Don't say much nonsense. How do I build a Web project with maven?

First step: Create a MAVEN project first

The created directory structure is as follows

This directory structure is not what we want, so we need to change it.

Step two: Make adjustments to the directory structure

1. Select the project point right mouse button-->properties-->project Facets, remove the front of the red box, and then save

2. Then check it again, and a link will appear below this time

3. Click on this link to set up the popup page, then click OK

4. Select Deployment Assembly

The directory structure after the modification is as follows:

Step Three: Configure the Pom.xml file to add Web dependencies

<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > <modelversion>4.0.0 </modelVersion> <groupId>com.ssh</groupId> <artifactId>mvn-ssh</artifactId> <ver Sion>0.0.1-snapshot</version> <packaging>war</packaging> <dependencies> <!--SE Rvlet Basics-<dependency> <groupId>javax.servlet</groupId> <artifacti D>servlet-api</artifactid> <version>3.0-alpha-1</version> <scope>provided </scope> </dependency> <dependency> <groupid>javax.servlet</groupid&gt            ; <artifactId>jstl</artifactId> <version>1.2</version> </dependency> < /dependencies></project>

Fourth step: Detect whether the Web environment can pass

1. Create a new JSP page

2. Configuring the Web. xml file

    <welcome-file-list>        <welcome-file>index.jsp</welcome-file>    </welcome-file-list >

3. Launch Tomcat and access

At this point, using MAVEN to build a Web project ends

How to build a Web project using 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.