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

相关推荐
计科土狗几秒前
GESP六级专题之类与对象
java·前端·数据库
Slow菜鸟38 分钟前
第3篇:实操落地篇 · 3套企业标准工作流(IDEA可视化版)
java·ide·intellij-idea
weixin_4407841139 分钟前
Java基础常见题
java·开发语言·python·java基础
掉鱼的猫1 小时前
Hot-Plug 实战:运行期管理 Solon 插件
java·hotfix
markinmarkin1 小时前
Spring 中有哪些方式可以把Bean 注入到IOC 容器?
java·spring
带刺的坐椅1 小时前
Hot-Plug 实战:运行期管理 Solon 插件
java·solon·插件·热插拔
大黄说说1 小时前
SQL Server 执行计划怎么看?快速定位 SQL 慢的根源
java·linux·数据库
雪之下雪乃的代码日记2 小时前
Python快速入门(Java开发者版)
java·开发语言·笔记·python
敲个大西瓜2 小时前
Springboot核心面试题
java·spring boot·后端
器灵科技2 小时前
Seedance2.5 VS MiniMax H3 同日上线:AI短剧创作者该怎么选?
java·人工智能·阿里云·prompt·aigc