maven需要jdk环境
yum安装版 https://blog.csdn.net/u012998306/article/details/88646787
安装jdk
tar -xvf jdk-8u91-linux-x64.tar.gz -C /usr/local ln -s /usr/local/jdk1.8.0_91/ /usr/local/java
环境变量
vim /etc/profile JAVA_HOME=/usr/local/java PATH=$JAVA_HOME/bin:$PATH export JAVA_HOME PATH source /etc/profile
验证
# env |grep JAVA JAVA_HOME=/usr/local/java # java -version java version "1.8.0_91" Java(TM) SE Runtime Environment (build 1.8.0_91-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
安装maven
下载地址
wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz
解压命令
# tar -zxf apache-maven-3.5.4-bin.tar.gz # mv apache-maven-3.5.4 /usr/local/maven
配置环境变量
# vi /etc/profile M2_HOME=/usr/local/maven export PATH=${M2_HOME}/bin:${PATH}
source /etc/profile
查看版本
# mvn –v Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-18T02:33:14+08:00) Maven home: /usr/local/maven Java version: 1.8.0_91, vendor: Oracle Corporation, runtime: /usr/local/jdk1.8.0_91/jre Default locale: zh_CN, platform encoding: UTF-8 OS name: "linux", version: "3.10.0-957.el7.x86_64", arch: "amd64", family: "unix"
yum 版安装
wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo yum -y install apache-maven
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo sudo sed -i s/$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo sudo yum install -y maven
# mvn -version
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-18T02:33:14+08:00)
Maven home: /usr/local/maven
Java version: 1.8.0_91, vendor: Oracle Corporation, runtime: /usr/local/jdk1.8.0_91/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-957.el7.x86_64", arch: "amd64", family: "unix"