当前位置: 首页 > news >正文

maven中的仓库的配置与优先级

文章目录

  • 1 仓库的具体配置
    • 1.1 settings.xml配置本地仓库
    • 1.2 pom.xml配置的仓库
    • 1.3 settings.xml配置mirror镜像
    • 1.4 settings.xml配置profile仓库
  • 2 结论
    • 2.1 mirror中不代理`*`的拉取顺序
    • 2.2 mirror中代理了`*`的拉取顺序

1 仓库的具体配置

1.1 settings.xml配置本地仓库

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"><!-- localRepository| The path to the local repository maven will use to store artifacts.|| Default: ${user.home}/.m2/repository<localRepository>/path/to/local/repo</localRepository>--><localRepository>D:\Program Files\apache-maven-3.6.3\conf\repository</localRepository>
</settings>

1.2 pom.xml配置的仓库

<project><repositories><repository><id>com.e-iceblue</id><name>e-iceblue</name><url>https://repo.e-iceblue.com/nexus/content/groups/public/</url></repository></repositories>
</project>

1.3 settings.xml配置mirror镜像

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"><mirrors><mirror><id>aliyun-central</id><name>aliyun-central</name><mirrorOf>central</mirrorOf><url>https://maven.aliyun.com/repository/central</url></mirror><mirror><id>aliyun-spring</id><name>aliyun-spring</name><mirrorOf>spring</mirrorOf><url>https://maven.aliyun.com/repository/spring</url></mirror><mirror><id>aliyun-spring-plugin</id><name>aliyun-spring-plugin</name><mirrorOf>spring-plugin</mirrorOf><url>https://maven.aliyun.com/repository/spring-plugin</url></mirror></mirrors>
</settings>

1.4 settings.xml配置profile仓库

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"><servers><server><id>nexus-server</id><username>uname</username><password>pwd</password></server></servers><profiles><profile><id>nexus</id><repositories><repository><id>nexus-server</id><name>Nexus Repository</name><url>https://maven.nexus.com/repository/maven-public/</url><snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots></repository></repositories></profile></profiles><!--让配置生效--><activeProfiles><activeProfile>nexus</activeProfile></activeProfiles>
</settings>

2 结论

2.1 mirror中不代理*的拉取顺序

  1. settings.xml->本地仓库,如果没有则向下找
  2. settings.xml->profile中的仓库,如果没有则向下找
  3. pom.xml配置的仓库,如果没有则向下找
  4. settings.xml->mirror中代理central的仓库

2.2 mirror中代理了*的拉取顺序

mirror中一旦代理了*,则该配置优先级最高,其他的都不会走了。
但是有一种情况除外,就是mirror中代理了central仓库,那么如果代理*的 mirror中没有,则会找代理的central仓库

  1. settings.xml->本地仓库,如果没有则向下找
  2. settings.xml->mirror中代理*的仓库,如果没有则向下找
  3. settings.xml->mirror中代理central的仓库

http://www.mrgr.cn/news/24275.html

相关文章:

  • 水平垂直居中的几种方法(总结)
  • 基于Spring Boot的电子请柬私人定制销售平台的设计与实现---附源码78900
  • 史级低价1元《魔域口袋版》神话斗神·黑悟空 带领战队傲视群雄
  • 住宅建筑电气火灾预防
  • electron有关mac构建
  • 【C语言进阶】C语言动态内存管理:深入理解malloc、calloc与realloc
  • 中国企业500强!最新名单揭晓→
  • 基于SpringBoot+Vue的考务管理系统
  • 【TCP】相关机制:异常处理
  • 多线程获取留言板
  • css总结(记录一下...)
  • Pycharm 输入三个引号没有自动生成函数(方法)注释
  • 小白也能懂的ComfyUI使用教程和问题解决【AIStarter】
  • 【C++】创建静态数组,动态数组,vector数组
  • yarn install error Error: certificate has expired SSL证书过期
  • 汽车以太网100BASE-T1 和 1000BASE-T1特性
  • uniapp小程序,使用腾讯地图获取定位
  • PPT幻灯片的添加与编辑:全面技术指南
  • 【React源码解析】深入理解react时间切片和fiber架构
  • AI绘画:SD打光神器!(Stable Diffusion进阶篇:Imposing Consistent Light)