• Spring-boot的maven仓库配置阿里云镜像以及setting.xml和pom.xml的优先级


    阿里云镜像地址

    https://maven.aliyun.com/mvn/guide

    pom.xml

    在pom.xml文件中project结点下最后面,有个repositories结点,更改里面的url结点中的内容即可

     比如说,我是用public仓库

    <repositories>
        <repository>
            <id>aliyun</id>
            <name>AliYun</name>
            <url>https://maven.aliyun.com/repository/public</url>
        </repository>
    </repositories>

     这样修改即可

     一个java项目通过maven自动下载依赖时,会读取三个配置文件,分别是

    • 项目下的pom.xml 文件
    • 家目录下的.m2/settings.xml 与
    • maven 全局配置settings.xml

     后面两者不难理解,就像linux下的用户一样,有一个/etc/profile ,用户用目录下还有一个.bash_profile 文件是一样的

     用户自定义配置会覆盖全局配置

     所以三者的级先是 pom.xml  > /home_dir/.m2/settings.xml > /maven_dir/conf/settings.xml 

     如果要全局修改,需要在mavn3/conf下找到setting.xml来修改

     

    <mirrors>
        <!-- mirror
         | Specifies a repository mirror site to use instead of a given repository. The repository that
         | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
         | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
         |
        <mirror>
          <id>mirrorId</id>
          <mirrorOf>repositoryId</mirrorOf>
          <name>Human Readable Name for this Mirror.</name>
          <url>http://my.repository.com/repo/path</url>
        </mirror>
         -->
         <mirror>
            <id>aliyun</id>
            <mirrorOf>public</mirrorOf>
            <name>AliYun</name>
            <url>https://maven.aliyun.com/repository/public</url>
          </mirror>
        </mirrors>
  • 相关阅读:
    在ASP.Net和IIS中删除不必要的HTTP响应头
    Json对象与Json字符串互转
    Jquery ajax传递复杂参数给WebService
    HTTP的KeepAlive是开启还是关闭?
    MQ产品比较-ActiveMQ-RocketMQ
    RocketMQ(7)——通信协议
    mq使用经验
    mq
    RocketMQ
    发送短信验证码实现方案
  • 原文地址:https://www.cnblogs.com/YC-L/p/14286720.html
Copyright © 2020-2023  润新知