释放双眼,带上耳机,听听看~!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 1#!/bin/bash
2
3echo "安装Java环境,先安装JDK"
4yum -y install java-openjdk
5
6echo "切换到/usr/local/src下载目录"
7cd /usr/local/src/
8
9echo "下载软件"
10yum -y install wget
11wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.tar.gz
12
13echo "解压缩到指定目录"
14tar -zxv -f apache-maven-3.6.2-bin.tar.gz -C /usr/local/
15
16echo "设置环境变量"
17cat > /etc/profile.d/maven.sh << EOF
18#!/bin/bash
19
20export MAVEN_HOME=/usr/local/apache-maven-3.6.2
21export PATH=$PATH:$MAVEN_HOME/bin
22
23EOF
24
25source /etc/profile.d/maven.sh
26
27echo "验证"
28echo ${MAVEN_HOME}
29
30mvn -version
31
32echo "设置Maven仓库地址为阿里云仓库"
33echo "需要手动操作"
34
35#vim /usr/local/apache-maven-3.6.2/conf/settings.xml
36
37#<mirrors>
38# <mirror>
39# <id>alimaven</id>
40# <name>aliyun maven</name>
41# <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
42# <mirrorOf>central</mirrorOf>
43# </mirror>
44#</mirrors>
45