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,你可以试试看

相关推荐
码上淘金8 分钟前
在 YAML 中如何将 JSON 对象作为字符串整体赋值?——兼谈 Go Template 中的 fromJson 使用
java·golang·json
刘一说27 分钟前
Spring Boot 应用的指标收集与监控体系构建指南
java·spring boot·后端
老友@1 小时前
Java Excel 导出:EasyExcel 使用详解
java·开发语言·excel·easyexcel·excel导出
Full Stack Developme1 小时前
java.net.http 包详解
java·http·.net
daidaidaiyu2 小时前
Spring BeanPostProcessor接口
java·spring
weixin_436525072 小时前
SpringBoot 单体服务集成 Zipkin 实现链路追踪
java·spring boot·后端
她说..2 小时前
Redis实现未读消息计数
java·数据库·redis·缓存
book多得2 小时前
Redis 大 Key 问题:识别、危害与最优处理方案
java·redis·mybatis
任子菲阳3 小时前
学Java第四十三天——Map双列集合
java·开发语言
zeijiershuai3 小时前
Java 会话技术、Cookie、JWT令牌、过滤器Filter、拦截器Interceptor
java·开发语言