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

相关推荐
于先生吖20 小时前
2026 新版 Java 同城上门家政服务系统源码 完整可运营
java·开发语言
gp32102620 小时前
什么是Spring Boot 应用开发?
java·spring boot·后端
happymaker062620 小时前
JDBC(MySQL)——DAY04(调用存储过程,存储函数)
java·数据库·mysql
清空mega20 小时前
第7章:JavaBean、Servlet 与 MVC——从 JSP 页面开发走向规范项目
java·servlet·mvc
惊讶的猫20 小时前
springboot常用注解
java·spring boot·后端
tuyanfei20 小时前
SpringSecurity+jwt实现权限认证功能
java
yhole20 小时前
【SpringBoot】单元测试实战演示及心得分享
java
OKkankan21 小时前
撕 STL 系列:封装红黑树实现 mymap 和 myset
java·c++·算法
C蔡博士21 小时前
最近点对问题(Closest Pair of Points)
java·python·算法
APIshop21 小时前
Java调用亚马逊商品详情API接口完全指南
java·开发语言·python