peteryuanpan / notebook

喜欢的,值得留念的,就记下来,总会有用的。
73 stars 43 forks source link

给Maven添加阿里云镜像以加速下载 #195

Closed peteryuanpan closed 3 years ago

peteryuanpan commented 3 years ago

参考:https://blog.csdn.net/zhuzj12345/article/details/93200211

maven从官网库中下载太慢了,可以添加阿里云镜像国内源,加速下载

方法 1 2 任选其一

1、在项目的pom.xml里直接加入

<repositories><!-- 代码库 -->  
    <repository>  
        <id>maven-ali</id>  
        <url>http://maven.aliyun.com/nexus/content/groups/public//</url>;  
        <releases>  
            <enabled>true</enabled>  
        </releases>  
        <snapshots>  
            <enabled>true</enabled>  
            <updatePolicy>always</updatePolicy>  
            <checksumPolicy>fail</checksumPolicy>  
        </snapshots>  
    </repository>  
</repositories>

2、在$MAVEN_HOME的conf文件夹的setting.xml的标签里加入

<mirror>  
  <id>alimaven</id>  
  <name>aliyun maven</name>  
  <url>http://maven.aliyun.com/nexus/content/groups/public/</url>;  
  <mirrorOf>central</mirrorOf>          
</mirror>