Build your first MAVEN project

Source: Internet
Author: User

First, Maven Introduction

MAVEN is a powerful project management and building automation tool that manages the project and its build process through an abstract project object model and build lifecycle model, and MAVEN maximizes the duplication of builds and improves the efficiency and standardization of the build.
In addition, Maven has features such as dependency management, automatic project site generation, and code static checking. Now that there are countless open source or commercial projects using MAVEN to build, MAVEN is now a building tool for the Java Community's de facto standard.

Second, download the installation

Official website: http://maven.apache.org/

: http://maven.apache.org/download.cgi

Decompression Apache-maven-3.3.9-bin.zip

Configure MAVEN environment variable, new m2_home, variable value fill in Maven's root directory

Then edit the path variable and introduce the M2_home variable (the bin under the root directory) such as:;%m2_home%\bin; Test open cmd, enter mvn-version to view maven's version if you see the version number, the configuration is successful.

Third, the use

1. Create a project framework with MAVEN commands

MVN Archetype:generate-dgroupid=com.test-dartifactid=test-darchetypeartifactid=maven-archetype-webapp

DgroupId and DartifactId indicate that the coordinates of the callout item Darchetrypeartifacttid represent the prototype WebApp using MAVEN to create the project after creating the directory structure as follows
  • MyWebApp
  • +---Pom.xml
  • +---SRC
  • +---Main
  • +---Resources
  • +---WebApp
  • +---index.jsp
  • +---Web-inf
  • +---web. xml

Execute MVN install and place target under Test.war under Tomcat WebApps, launch Tomcat, access via browser: http://localhost:8080/test/

You will see the familiar: "Hello world!"

Build your first MAVEN project

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.