45、Linux初步(CentOS 7下安裝Maven)
阿新 • • 發佈:2018-12-31
1、下載安裝Maven
地址:http://maven.apache.org/
解壓Maven
tar -zxv maven檔名
2、配置環境變數:
vi /etc/profile
新增如下程式碼:
export JAVA_HOME=/usr/java/jdk1.8.0_121
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/jre/lib/tools.jar
export M2_HOME=/home/java/maven/maven3.3.9
export PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin
如果配置了jdk,可以跳過jdk配置
3、輸入mvn -v命令檢視是否安裝成功
[[email protected] maven]# mvn -v Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00) Maven home: /home/java/maven/maven3.3.9 Java version: 1.8.0_121, vendor: Oracle Corporation Java home: /usr/java/jdk1.8.0_121/jre Default locale: zh_CN, platform encoding: UTF-8 OS name: "linux", version: "3.10.0-327.el7.x86_64", arch: "amd64", family: "unix"