#!/bin/bash
source /etc/profile
wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz --no-check-certificate
tar -zxvf apache-maven-3.8.6-bin.tar.gz
cp /opt/maven/apache-maven-3.8.6/conf/settings.xml /opt/maven/apache-maven-3.8.6/conf/settings.xml.bak
> /opt/maven/apache-maven-3.8.6/conf/settings.xml
mkdir -p /opt/m2/repository
echo "<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
<localRepository>/opt/m2/repository</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
</servers>
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<profiles>
</profiles>
</settings>
" >> /opt/maven/apache-maven-3.8.6/conf/settings.xml
echo "export PATH=$PATH:/opt/maven/apache-maven-3.8.6/bin" >> /etc/profile
source /etc/profile
mvn -version
linux快速脚本脚本安装maven-3.8.6
最新推荐文章于 2023-11-15 21:45:06 发布