Easy Tutorial
❮ Maven Snapshots Project Templates ❯

Maven Environment Configuration

Maven is a Java-based tool, so the first thing you need to do is install the JDK.

If you haven't installed the JDK yet, you can refer to our Java Development Environment Configuration.

System Requirements

Item Requirement
JDK Maven 3.3 requires JDK 1.7 or above <br>Maven 3.2 requires JDK 1.6 or above <br>Maven 3.0/3.1 requires JDK 1.5 or above
Memory No minimum requirement
Disk Maven itself requires about 10 MB of space. Additionally, extra disk space will be needed 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 requirement

Checking Java Installation

Operating System Task Command
Windows Open Command Console c:> java -version
Linux Open Command Terminal # java -version
Mac Open Terminal $ java -version

Maven Download

Maven download link: 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, extract the package to the corresponding directory:

System Storage Location (configurable as per your 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

Setting Maven Environment Variables

Add the environment variable MAVEN_HOME:

System Configuration
Windows Right-click "Computer", select "Properties", then click "Advanced system settings", click "Environment Variables" to set the environment variables. You need to configure the following system variables: Create a new system variable MAVEN_HOME with the value: E:\Maven\apache-maven-3.3.9. Edit the system variable Path, add the value: ;%MAVEN_HOME%\bin. Note: Ensure multiple values are separated by semicolons, then click OK.
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<br># tar -xvf apache-maven-3.3.9-bin.tar.gz<br># sudo mv -f apache-maven-3.3.9 /usr/local/ Edit the /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<br>export PATH=${PATH}:${MAVEN_HOME}/bin Save the file and run the following command to make the environment variables effective: # source /etc/profile In the console, input the following command. If you can see Maven 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<br>$ tar -xvf apache-maven-3.3.9-bin.tar.gz<br>$ sudo mv -f apache-maven-3.3.9 /usr/local/ Edit the /etc/profile file with sudo vim /etc/profile, and append the following code at the end of the file: export MAVEN_HOME=/usr/local/apache-maven-3.3.9<br>export PATH=${PATH}:${MAVEN_HOME}/bin Save the file and run the following command to apply the environment variables: $ source /etc/profile Enter the following command in the console, and if you see Maven version information, it means Maven has been installed successfully: $ mvn -v<br>Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)<br>Maven home: /usr/local/apache-maven-3.3.9<br>Java version: 1.8.0_31, vendor: Oracle Corporation<br>Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre<br>Default locale: zh_CN, platform encoding: ISO8859-1<br>OS name: "mac os x", version: "10.13.4", arch: "x86_64", family: "mac"
❮ Maven Snapshots Project Templates ❯