CentOS7 、JDK8 、apache-maven-3.8.5-bin.tar.gz(版本自己选择)
我的上传路径是 /usr/local
tar -zxvf apache-maven-3.8.5-bin.tar.gz mv apache-maven-3.8.5 maven-3.8.5
vi /etc/profile ################将下面这两行代码拷贝到文件末尾并保存################ MAVEN_HOME=/usr/local/maven-3.8.5 export PATH=$PATH:$MAVEN_HOME/bin ################################ source /etc/profile mvn –v #查看maven是否安装成功 # 成功如下 Apache Maven 3.8.5 Maven home: /usr/local/maven-3.8.5 Java version: 1.8.0_321, vendor: Oracle Corporation, runtime: /usr/local/java/jre
mkdir /usr/local/maven-3.8.5/repo #创建本地仓库 vi /usr/local/maven-3.8.5/conf/settings.xml
用下面的阿里镜像替换配置文件源
<mirror> <id>aliyun</id> <mirrorOf>*</mirrorOf><!--所有访问都使用该镜像库--> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> </mirror>
指定本地仓库位置
<localRepository>/usr/local/maven-3.8.5/repo</localRepository>