maven installation and configuration

maven environment configuration articles

Required tools:
1.JDK

2.Maven

3.Windows 7

Note

Maven 3.2 requires JDK 1.6 or above, while Maven 3.0/3.1 requires JDK 1.5 or above.

1. Download
Download address: http://maven.apache.org/download.html , find the download link after opening it
write picture description here
2. Install

Make sure the JDK is installed and the "JAVA_HOME" variable has been added to the Windows environment variables.

We will extract the downloaded installation package to the following directory:
D:\Program Files\Apache\maven

3. Environment configuration
Add
M2_HOME and MAVEN_HOME to open the system properties panel (right-click "Computer" > "Properties"), click Advanced System Settings, then click Environment Variables, create a new variable in the system variables, the variable name is M2_HOME, the variable The value is the installation directory of Maven

write picture description here

Maven says to just add M2_HOME, but some projects still reference Maven's folder MAVEN_HOME, so add it to be safe too.

write picture description here

Add to environment variable - PATH

Edit the PATH variable and add the Maven bin folder to the end of the PATH, such as: %M2_HOME%\bin, or ;%MAVEN_HOME%\bin\; so that it can be run from any directory in the command

4. Verify

Enter in the command line: echo %M2_HOME% and mvn –version or -v, the following interface appears, indicating that our maven has been successfully installed.

write picture description here

write picture description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324439973&siteId=291194637