CentOS 7 中安装Maven以及设置国内镜像地址

1、下载安装文件 
wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz


2、解压安装: 
tar -zxvf apache-maven-3.3.9-bin.tar.gz /opt/


3、配置环境变量 
    (1)、编辑/etc/profile文件,在/etc/profile文件末尾增加以下配置:
            M2_HOME=/opt/tyrone/maven (注意这里是maven的安装路径)
            export PATH=${M2_HOME}/bin:${PATH}
    (2)、重载/etc/profile
            source /etc/profile


4、检验maven是否安装成功
mvn -v 


5、在maven安装目录(我安装时指定的/opt/,所以安装目录在/opt/apache-maven-3.3.9/)的conf目录下的settings.xml文件的<mirrors>标签中增加以下内容:
     <mirror>
      <id>alimaven</id>
      <mirrorOf>central</mirrorOf>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>

    </mirror>


猜你喜欢

转载自blog.csdn.net/Yushl_sirius/article/details/78753351