Maven environment configuration
Maven is a Java-based tool, so the first thing to do is to install the JDK.
System Requirements
project | Claim |
---|---|
JDK | Maven 3.3 1.7 or more requires the JDK maven claim 1.6 or above 3.2 the JDK maven 3.0 / 3.1 or more claims JDK 1.5 |
RAM | There is no minimum requirement |
Disk | Maven their installation requires approximately 10 MB of space. In addition, additional disk space will be used for your local Maven repository. The size of your local repository depends on usage, it is expected that at least 500 MB |
operating system | There is no minimum requirement |
Check the Java installation
operating system | task | command |
---|---|---|
Windows | Open a command console | c:\> java -version |
Linux | Open a command terminal | # java -version |
Mac | Open a terminal | $ java -version |
Maven download
Maven Download: http://maven.apache.org/download.cgi
Different platforms to download the corresponding package:
system | Package names |
---|---|
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 extract to the corresponding directory:
system | Storage locations (according to its own configurable) |
---|---|
Windows | E:\Maven\apache-maven-3.3.9 |
Linux | /usr/local/apache-maven-3.3.9 |
Mac | /usr/local/apache-maven-3.3.9 |
Maven environment variable settings
Add the environment variable MAVEN_HOME:
system | Configuration |
---|---|
Windows | Right "Computer" and select "Properties", then click "Advanced System Settings", click on the "Environment Variables" to set environment variables, system variables need to configure the following: 新建系统变量 MAVEN_HOME,变量值:E:\Maven\apache-maven-3.3.9 编辑系统变量 Path,添加变量值:;%MAVEN_HOME%\bin 注意:注意多个值之间需要有分号隔开,然后点击确定。 |
Linux | 下载解压: # 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/ 编辑 /etc/profile 文件 sudo vim /etc/profile,在文件末尾添加如下代码: export MAVEN_HOME=/usr/local/apache-maven-3.3.9 export PATH=${PATH}:${MAVEN_HOME}/bin 保存文件,并运行如下命令使环境变量生效: # source /etc/profile 在控制台输入如下命令,如果能看到 Maven 相关版本信息,则说明 Maven 已经安装成功: # mvn -v |
Mac | 下载解压: $ 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/ 编辑 /etc/profile 文件 sudo vim /etc/profile,在文件末尾添加如下代码: export MAVEN_HOME=/usr/local/apache-maven-3.3.9 export PATH=${PATH}:${MAVEN_HOME}/bin 保存文件,并运行如下命令使环境变量生效: $ source /etc/profile 在控制台输入如下命令,如果能看到 Maven 相关版本信息,则说明 Maven 已经安装成功: $ 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/JavaVirtualMachines/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", arch: "x86_64", family: "mac" |