【maven】配置下载私有仓库的快照版本

1、setting.xml配置

复制代码
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      https://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository>/root/.m2/repository</localRepository>
  
  <servers>
    <server>
      <id>dev-maven</id>
      <username>admin</username>
      <password>xxxx</password>
    </server>
  </servers>


  <mirrors>
    <mirror>      
      <id>dev-maven</id>
      <name>dev-maven</name>
      <mirrorOf>*</mirrorOf>   <!-- 这个要配置 *,配置maven的中央地址的话,不行-->
      <url>http://xx.xx.xx.22/nexus/repository/maven-public/</url>
    </mirror>
  </mirrors>


  <profiles>
    <profile>
    <id>dev-maven</id>
    <repositories>
        <repository>
            <id>dev-maven</id>
            <name>dev-maven</name>
            <url>http://xx.xx.xx.22/nexus/repository/maven-public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>  <!-- 开启这个配置true,允许下载快照版本-->
            </snapshots>
        </repository>
    </repositories>
   </profile>
  </profiles>

  <activeProfiles>
    <activeProfile>dev-maven</activeProfile>
  </activeProfiles>


</settings>

2、POM.xml文件配置

复制代码
  <repositories>
    <repository>
      <id>dev-maven</id>
      <name>dev-maven</name>
      <url>http://xxx.xxx.xx.22/nexus/repository/maven-public/</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>
相关推荐
wifi___7 小时前
全局异常处理的原理
java·开发语言
2601_9638702012 小时前
【计算机毕业设计】基于Spring Boot的专科医院医疗管理系统
java·spring boot·课程设计
Bingo_BIG12 小时前
Java Spring 批量修改,实体、接口、方法的定义
java·spring
画中有画12 小时前
软件架构中质量属性(性能、安全、可扩展性)的权衡设计
java·运维·安全
Shaoxi Zhang13 小时前
JAVA学习笔记035——对象和JSON格式
java·笔记·学习
赵丙双13 小时前
CountDownLatch 源码分析
java·aqs·countdownlatch
余额瞒着我当琳13 小时前
C++--深拷贝三件套 + swap + 写时拷贝 + vector 扩容 + reserve
java·开发语言·c++
thefool11226613 小时前
翻转二叉树
java
喜欢打篮球的普通人14 小时前
LLVM Backend Lowering 从入门到实战:把 IR 变成机器码的完整链路
android·java·数据库
FL162386312914 小时前
室内易燃物识别易燃评估室内易燃程度识别分割数据集labelme格式1015张85类别
java·服务器·前端