linux-tutorial/docs/deploy/tool/install-maven.md
2018-10-10 17:31:35 +08:00

47 lines
960 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Maven 安装
> 环境要求:
>
> - JDK
<!-- TOC depthFrom:2 depthTo:3 -->
- [安装方法](#安装方法)
- [脚本](#脚本)
<!-- /TOC -->
## 安装方法
安装步骤如下:
1下载
进入官网下载地址https://maven.apache.org/download.cgi ,选择合适的版本下载。
我选择的是最新 Maven3 版本http://mirrors.hust.edu.cn/apache/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz
2解压到本地
我个人喜欢存放在:`/opt/maven`
3设置环境变量
输入 `vi /etc/profile` ,添加环境变量如下:
```
# MAVEN 的根路径
export MAVEN_HOME=/opt/maven/apache-maven-3.5.2
export PATH=\$MAVEN_HOME/bin:\$PATH
```
执行 `source /etc/profile` ,立即生效
4检验是否安装成功执行 `mvn -v` 命令
## 脚本
以上两种安装方式,我都写了脚本去执行:
| [安装脚本](https://github.com/dunwu/linux/tree/master/codes/deploy/tool/maven) |