maven的依赖在私服,如何设置优先读取本地

pom.xml 有个parent配置,parent的pom里有几个依赖要从私服下载,我把私服的包下载好了放在本地的repo里,mvn package的时候还会去从私服下载,然后报错 ,咋解决?

亲测可用!!!!!!

设置maven的settings.xml mirror

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>central</id>
      <mirrorOf>*</mirrorOf>
      <name>central</name>
      <url>file://D:\dev\maven-repo</url>
    </mirror>
     <mirror>
        <id>alimaven</id>
        <name>aliyun maven</name>
        <url>
            http://maven.aliyun.com/nexus/content/groups/public/
        </url>
        <mirrorOf>central</mirrorOf>
    </mirror>
  </mirrors>

增加了一个本地repo的mirror,你可以试试看

相关推荐
RFG20121 小时前
20、详解Dubbo框架:消费方如何动态获取服务提供方地址?【微服务架构入门】
java·人工智能·后端·微服务·云原生·架构·dubbo
zjttsh2 小时前
Linux下安装Redis
java
TimberWill3 小时前
SpringBoot整合Srping Security实现权限控制
java·spring boot·后端
Renhao-Wan4 小时前
Java 算法实践(四):链表核心题型
java·数据结构·算法·链表
_codemonster5 小时前
JavaWeb开发系列(六)JSP基础
java·开发语言
万邦科技Lafite5 小时前
淘宝店铺所有商品API接口实战指南
java·数据库·mysql
jjjxxxhhh1235 小时前
【加密】-AES与对称加密
java·服务器·网络
临水逸5 小时前
飞牛fnos 2025 漏洞Java跨域URL浏览器
java·开发语言·安全·web安全
yaoxin5211236 小时前
324. Java Stream API - 实现 Collector 接口:自定义你的流式收集器
java·windows·python
H Corey6 小时前
数据结构与算法:高效编程的核心
java·开发语言·数据结构·算法