【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>
相关推荐
坐不住的爱码2 分钟前
静态资源映射-spring整合
java·spring·状态模式
大佐不会说日语~3 分钟前
基于Spring AI Alibaba的AI聊天系统中,流式输出暂停时出现重复插入问题的分析与解决
java·人工智能·spring
0和1的舞者9 分钟前
API交互:前后端分离开发实战指南
java·spring·tomcat·web3·maven·springmvc·springweb
一 乐12 分钟前
宠物店管理|基于Java+vue的宠物猫店管理管理系统(源码+数据库+文档)
java·开发语言·前端·数据库·vue.js·spring boot·后端
天天摸鱼的小学生13 分钟前
【Java泛型一遍过】
java·开发语言·windows
骇客野人35 分钟前
JAVA获取一个LIST中的最大值
java·linux·list
JIngJaneIL37 分钟前
基于Java失物招领系统(源码+数据库+文档)
java·开发语言·前端·数据库·vue.js·spring boot·vue
程序员岳焱37 分钟前
Java泛型高级玩法:通配符、上下界与类型擦除避坑实战(纯干货,附完整工具类)
java·后端·程序员
期待のcode37 分钟前
MyBatis-Plus基本CRUD
java·spring boot·后端·mybatis
❀͜͡傀儡师37 分钟前
maven 仓库的Central Portal Namespaces 怎么验证
java·maven·nexus