File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree File renamed without changes.
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3+ cat << EOF
34###################################################################################
4- # 安装 Maven 脚本
5+ # 安装 Maven3 脚本
56# 适用于所有 linux 发行版本。
67# Maven 会被安装到 /opt/maven 路径。
78# 注意:Maven 要求必须先安装 JDK
89# Author: Zhang Peng
910###################################################################################
11+ EOF
1012
11- echo -e " \n>>>>>>>>> install maven"
13+ version=3.6.0
14+ if [[ -n $1 ]]; then
15+ version=$1
16+ fi
17+
18+ root=/opt/maven
19+ if [[ -n $2 ]]; then
20+ root=$2
21+ fi
1222
13- mkdir -p /opt/maven
14- cd /opt/maven
23+ echo -e " \n>>>>>>>>> download maven"
24+ mkdir -p ${root}
25+ cd ${root}
1526
16- version=3.5.4
17- wget --no-check-certificate --no-cookies --header " Cookie: oraclelicense=accept-securebackup-cookie" http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/${version} /binaries/apache-maven-${version} -bin.tar.gz
18- tar -zxvf apache-maven-${version} -bin.tar.gz
27+ wget --no-check-certificate --no-cookies --header " Cookie: oraclelicense=accept-securebackup-cookie" -O ${root} /apache-maven-${version} -bin.tar.gz http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/${version} /binaries/apache-maven-${version} -bin.tar.gz
28+
29+ echo -e " \n>>>>>>>>> install maven"
30+ tar -zxvf apache-maven-${version} -bin.tar.gz -C ${root}
1931
2032# 设置环境变量
2133cat >> /etc/profile << EOF
@@ -27,4 +39,4 @@ source /etc/profile
2739# 备份并替换 settings.xml,使用 aliyun 镜像加速 maven
2840echo -e " \n>>>>>>>>> replace /opt/maven/apache-maven-${version} /conf/settings.xml"
2941cp /opt/maven/apache-maven-${version} /conf/settings.xml /opt/maven/apache-maven-${version} /conf/settings.xml.bak
30- wget -N https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/maven /settings-aliyun.xml -O /opt/maven/apache-maven-${version} /conf/settings.xml
42+ wget -N https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/config /settings-aliyun.xml -O /opt/maven/apache-maven-${version} /conf/settings.xml
Load Diff This file was deleted.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments