zoukankan      html  css  js  c++  java
  • maven配置阿里云镜像仓库

    全局配置:添加镜像到 maven 的 setting.xml 文件中,这样就不需要每次在项目的 pom 文件中配置了

      在settings.xml文件中的mirrors下添加mirror标签,可以配置多个,按配置先后顺序使用,如果第一个不可用会自动使用第二个。

    <!-- 阿里云仓库1 -->
        <mirror>      
          <id>nexus-aliyun</id>    
          <name>nexus-aliyun</name>  
          <url>http://maven.aliyun.com/nexus/content/groups/public</url>    
          <mirrorOf>central</mirrorOf>      
        </mirror>
    
        <!-- 阿里云仓库2 -->
        <mirror>
            <id>alimaven</id>
            <mirrorOf>central</mirrorOf>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
        </mirror>

      < mirrorOf> 可以设置为哪个中央仓库做镜像,为名为 “central” 的中央仓库做镜像,写作< mirrorOf>central< /mirrorOf>;

      为所有中央仓库做镜像,写作< mirrorOf>*< /mirrorOf>。maven默认中央仓库的id 为 central。id是唯一的。

    单项目配置:

      单项目配置时,需要修改项目的 pom 文件。pom文件中,没有mirror元素。在 pom 文件中,通过覆盖默认的中央仓库的配置,实现中央仓库地址的变更。 

    <repositories>
            <repository>
                <id>central</id>
                <name>aliyun maven</name>
                <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
                <layout>default</layout>
                <!-- 是否开启发布版构件下载 -->
                <releases>
                    <enabled>true</enabled>
                </releases>
                <!-- 是否开启快照版构件下载 -->
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
            </repository>
        </repositories>

      默认中央仓库的id 为 central。id是唯一的,因此使用< id>central< /id>覆盖了默认的中央仓库。

  • 相关阅读:
    Android系统启动:1-综述
    在高通Fastmmi模式中增强交互方式
    Ubuntu 18.04安装xdrp以使用远程桌面
    如何在Android 确定 lunch对应的内核配置
    Android ADB命令集锦
    Android日志系统(logging system)
    汉诺塔游戏
    设置静态ip
    navicat的下载、激活
    上传本地文件到github(码云)上(小乌龟方式,sourcetree方式)
  • 原文地址:https://www.cnblogs.com/roadlandscape/p/12348692.html
Copyright © 2011-2022 走看看