Centos7 安装 maven3.9.6

maven官网:https://maven.apache.org/download.cgi

1.下载 maven 3.9.6 安装包

wget https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz --no-check-certificate

2.创建一个安装 maven 的目录

mkdir /usr/local/maven

3.解压下载的软件包

tar -zxvf apache-maven-3.9.6-bin.tar.gz -C /usr/local/maven/

4.配置环境变量

cat << EOF >> /etc/profile 

MAVEN_HOME=/usr/local/maven/apache-maven-3.9.6
PATH=\$PATH:\$MAVEN_HOME/bin
export MAVEN_HOME

EOF source
/etc/profile

5.查看新安装的 maven 版本。

mvn --version

 6.配置阿里云远程仓库

vim /usr/local/maven/apache-maven-3.9.6/conf/settings.xml

<mirrors> <!-- mirror | Specifies a repository mirror site to use instead of a given repository. The repository that | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used | for inheritance and direct lookup purposes, and must be unique across the set of mirrors. | <mirror> <id>mirrorId</id> <mirrorOf>repositoryId</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://my.repository.com/repo/path</url> </mirror> --> <mirror> <id>aliyunmaven</id> <mirrorOf>*</mirrorOf> <name>阿里云公共仓库</name> <url>https://maven.aliyun.com/repository/public</url> </mirror> </mirrors>

 

posted @ 2023-04-07 16:36  苦逼yw  阅读(374)  评论(0编辑  收藏  举报