美文网首页
修改maven镜像仓库地址为阿里镜像仓库

修改maven镜像仓库地址为阿里镜像仓库

作者: 乐观的猴 | 来源:发表于2020-02-03 12:11 被阅读0次
  1. 在项目的pom 文件指定仓库的地址
    优点: 比较灵活, 每个pom 可以指定不同的仓库地址, 适合一个项目有多个仓库的情况
    缺点: 对于单一仓库的, 就不太适用了
<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>
  1. 全局进行配置, 在 setting.xml 中指定
    优点: 配置一次就行了
    缺点: 对于一个项目有多个仓库的情况, 就不适用了.
  <mirrors>
    <id>nexus-aliyun</id>
    <mirrorOf>central</mirrorOf>
    <name>Nexus aliyun</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
  </mirrors>

相关文章

网友评论

      本文标题:修改maven镜像仓库地址为阿里镜像仓库

      本文链接:https://www.haomeiwen.com/subject/rckhxhtx.html