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

相关推荐
吠品22 分钟前
CSS图片模糊过渡:一个transition加filter就够
java·数据库·notepad++
步行cgn1 小时前
Spring 全注解开发详解
java·后端·spring
长河1 小时前
Java的GC(垃圾回收)中,标记无用对象的核心方法是可达性分析算法
java·jvm·算法
code2cat2 小时前
Java进阶篇之LongAdder:把统计更新分散,再读取总和
java·并发编程·原子类·longadder
凯哥Java2 小时前
写代码怎么避免逻辑漏洞?
java·开发语言·人工智能·自动化
Ivanqhz2 小时前
正余弦位置编码(Sinusoidal Positional Encoding)
java·linux·数据库
BD_Marathon2 小时前
消息对象中字段的说明
java·前端·python
zlpzlpzyd2 小时前
nacos的openapi地址
java
落魄实习生3 小时前
Agent Scope Java 2.x 系列【10】Middleware
java·开发语言·ai
ZealSinger4 小时前
Spring7 RestTemplate弃用迁移
java·spring·后端开发·restclient