Maven introduction and installation configuration


First, why should use Maven

Using current technology stack development refers not use Maven project.

Here Insert Picture Description

The above image is a development of the necessary technology, the use of these technologies can be developed, but there are some obvious questions:

  • A project is a project.

  • The project required jar package must be manually "copy and paste" to the next WEB-INF / lib directory.

  • jar package need someone ready for us, or to the official website to download.

  • A jar jar package depends on other packages need to manually added to the project.

The use of Maven, on top of all these problems can be resolved.

Second, what is Maven

Maven is a Java platform serving the automated build tools , focus on serving the Java platform 项目构建and 依赖管理.

1. The process of building links

① cleaning: remove the previous compilation results, prepare for recompilation.
② compile: The Java source code is compiled into bytecode files.
③ Test: Test for the project key points to ensure the correctness of the project in an iterative development process key points.
④ reports: After each test recording in standard format and display test results.
⑤ Packaging: a project file contains many packaged as a compressed file for installation or deployment. Java project corresponds to jar package, Web project corresponds war package.
Installation ⑥: Maven environment especially in the packaging packets or war results --jar package to the local repository.
⑦ deployment: The deployment of the packaged results to a remote warehouse or war will deploy the package to run on the server.

The directory structure comparison 2.Web engineering and compile results

Here Insert Picture Description

3.Maven core concepts

  • 几个重要的概念
    (1) stipulated in the directory structure
    (2) the POM
    (. 3) coordinates
    (4) dependent
  • 几个需要了解的概念
    (5) Storage
    (6) Life Cycle / plug / target
    (7) Inherited
    (8) Polymerization

Third, install and configure

1. Make sure the computer has been configured JDK environment

Mavaen is dependent on the JDK, if you are using JAVA_HOME form, you can enter in the dos command echo %JAVA_HOME%to view the jdk version:

	C:\Users\Hudie>echo %JAVA_HOME%
	D:\Program Files\JAVA\jdk1.7

2. Extract the archive Maven core program

Maven core decompression program archive, and placed in a non-Chinese name of the file folder.

Can go to the Maven's official website to download, can be downloaded directly to the cloud disk https://pan.baidu.com/s/1gXRsmcpmn5eqUDwr_SDK8Q
extraction code: 5ip0

The version here is maven-3.2.2

3. Configure Maven environment variable

① configuration MAVEN_HOME or M2_HOME

Listen to the older generation say here with M2_HOME avoid some weird error, so here with the M2_HOME.
Here Insert Picture Description
② configuration path
Here Insert Picture Description

(3) verify that the installed Maven

In the dos command line, type:mvn -v

	C:\Users\Hudie>mvn -v
	Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T21:51:42+08:00)
	Maven home: D:\Program Files\JAVA\Maven\apache-maven-3.2.2
	Java version: 1.7.0_75, vendor: Oracle Corporation
	Java home: D:\Program Files\JAVA\jdk1.7\jre
	Default locale: zh_CN, platform encoding: GBK
	OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "windows"

Similar to the version information appears above it shows installed.

Published 430 original articles · won praise 1195 · Views 270,000 +

Guess you like

Origin blog.csdn.net/weixin_43691058/article/details/104522452