- maven官方的中央仓库:https://mvnrepository.com/
1、下载maven
//Maven下载地址 https://maven.apache.org/download.cgi https://maven.apache.org/docs/history.html
2、安装maven
]# tar zvfx ./apache-maven-3.9.4-bin.tar.gz -C /usr/local/ ]# cd /usr/local/ ]# ln -s apache-maven-3.9.4 apache-maven
3、配置maven的环境变量
//(1)向/etc/profile文件中添加如下配置 ]# vim /etc/profile export MAVEN_HOME=/usr/local/apache-maven export PATH=${PATH}:$MAVEN_HOME/bin //(2)使配置生效 ]# source /etc/profile
4、验证maven是否已经安装配置成功
//如果安装配置成功,则会正确显示出maven和JDK的版本信息 ]# mvn -v Apache Maven 3.9.4 (dfbb324ad4a7c8fb0bf182e6d91b0ae20e3d2dd9) Maven home: /usr/local/apache-maven Java version: 1.8.0_162, vendor: Oracle Corporation, runtime: /usr/local/jdk1.8.0_162/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.10.0-1062.el7.x86_64", arch: "amd64", family: "unix"
5、配置maven
]# vim /usr/local/apache-maven/conf/settings.xml //配置本地仓库 <localRepository>/data/maven-repo</localRepository> //由于maven的中央仓库在国外,下载jar包速度可能比较慢,所以可以配置一个国内的私服,如阿里云的maven私服。 <mirrors> <mirror> <id>aliyun</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name> <url>https://maven.aliyun.com/repository/public</url> <blocked>true</blocked> </mirror> </mirrors>
1
# #标签:maven,安装,Maven,usr,https,apache,local From: https://www.cnblogs.com/maiblogs/p/17660117.html