Maven 下载地址:http://maven.apache.org/download.cgi
不同平台下载对应的包:
系统 | 包名 |
---|---|
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 |
添加环境变量 MAVEN_HOME:
下载解压:
# 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
<localRepository>E:\repo</localRepository>
<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>阿里云公共仓库snapshots</name>
<url>https://maven.aliyun.com/repository/apache-snapshots</url>
</mirror>
</mirrors>