【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>
相关推荐
Tigshop开源商城26 分钟前
『订单税率+收货地址校验国家字段』功能上新|跨境运营更高效,Tigshop开源商城系统 JAVA v5.8.23 版本更新
java·开源商城系统·tigshop
REDcker37 分钟前
C++变量存储与ELF段布局详解 从const全局到rodata与nm_readelf验证实践
java·c++·面试
kobesdu2 小时前
【ROS2实战笔记-19】ROS2 生命周期节点的启动顺序、状态转换陷阱与热备方案
java·前端·笔记·机器人·ros·ros2
neo_Ggx232 小时前
Maven 版本管理详解:SNAPSHOT、Release 与 Nexus 仓库的区别和影响
java·maven
matlabgoodboy2 小时前
软件开发定制小程序APP帮代做java代码代编写C语言设计python编程
java·c语言·小程序
江离w2 小时前
新版vibecoding项目初始化指令
java
tongluowan0073 小时前
Spring MVC 底层工作流程+源码分析
java·spring·mvc
java1234_小锋4 小时前
SpringBoot为什么要禁止循环依赖?
java·数据库·spring boot
折哥的程序人生 · 物流技术专研4 小时前
《Java 100 天进阶之路》第17篇:Java常用包装类与自动装箱拆箱深入
java·开发语言·后端·面试
RH2312114 小时前
2026.5.12 Linux
java·linux·数据结构