English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Maven is a Java-based tool, so the first thing to do is to install JDK.
If you have not installed JDK yet, you can refer to our Java development environment configuration.
project | requirements |
---|---|
JDK | Maven 3.3 requires JDK 1.7 or higher Maven 3.2 requires JDK 1.6 or higher Maven 3.0/3.1 requires JDK 1.5 or higher |
Memory | No minimum requirements |
Disk | The installation of Maven itself requires approximately 10 MB space. In addition, extra disk space will be used for your local Maven repository. The size of your local repository depends on usage, but it is expected to be at least 500 MB |
Operating system | No minimum requirements |
Operating system | Task | Command |
---|---|---|
Windows | Open command console | c:\> java -version |
Linux | Open command terminal | # java -version |
Mac | Open terminal | $ java -version |
Maven download address:http://maven.apache.org/download.cgi
Download the corresponding package for different platforms:
System | Package name |
---|---|
Windows | apache-maven-3.3.9-bin.zip |
Linux | apache-maven-3.3.9-bin.tar.gz |
Mac | apache-maven-3.3.9-bin.tar.gz |
After downloading the package, unzip it to the corresponding directory:
System | Storage location (can be configured according to your own situation) |
---|---|
Windows | E:\Maven\apache-maven-3.3.9 |
Linux | /usr/local/apache-maven-3.3.9 |
Mac | /usr/local/apache-maven-3.3.9 |
Add environment variable MAVEN_HOME:
System | Configure |
---|---|
Windows | Right-click "Computer", select "Properties", then click "Advanced System Settings", click "Environment Variables" to set environment variables. The following system variables need to be configured: Create a new system variable MAVEN_HOME, variable value: E:\Maven\apache-maven-3.3.9 Edit system variables Path, add variable value: ;%MAVEN_HOME%\bin Note:Note that multiple values must be separated by semicolons and then click Confirm. |
Linux | Download and extract: # wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz # tar -xvf apache-maven-3.3.9-bin.tar.gz # sudo mv -f apache-maven-3.3.9 /usr/local/ Edit /etc/profile File sudo vim /etc/profile, add the following code at the end of the file: export MAVEN_HOME=/usr/local/apache-maven-3.3.9 export PATH=${PATH}:${MAVEN_HOME}/bin Save the file and run the following command to make the environment variable effective: # source /etc/profile Enter the following command in the console, if you can see Maven related version information, it means Maven has been installed successfully: # mvn -v |
Mac | Download and extract: $ curl -O http://mirrors.hust.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz $ tar -xvf apache-maven-3.3.9-bin.tar.gz $ sudo mv -f apache-maven-3.3.9 /usr/local/ Edit /etc/profile File sudo vim /etc/profile, add the following code at the end of the file: export MAVEN_HOME=/usr/local/apache-maven-3.3.9 export PATH=${PATH}:${MAVEN_HOME}/bin Save the file and run the following command to make the environment variable effective: $ source /etc/profile Enter the following command in the console, if you can see Maven related version information, it means Maven has been installed successfully: $ mvn -v Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00) Maven home: /usr/local/apache-maven-3.3.9 Java version: 1.8.0_31, vendor: Oracle Corporation Java home: /Library/Java/Java Virtual Machines/jdk1.8.0_31.jdk/Contents/Home/jre Default locale: zh_CN, platform encoding: ISO8859-1 OS name: "mac os x", version: "10.13.4"86_64" |