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