【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>
相关推荐
tERS ERTS4 分钟前
MySQL中查看表结构
java
坊钰5 分钟前
Java 死锁问题及其解决方案
java·开发语言·数据库
于先生吖14 分钟前
SpringBoot+MQTT 无人健身房智能管控系统源码实战
java·spring boot·后端
仍然.42 分钟前
算法题目---模拟
java·javascript·算法
wefly20171 小时前
纯前端架构深度解析:jsontop.cn,JSON 格式化与全栈开发效率平台
java·前端·python·架构·正则表达式·json·php
nbwenren2 小时前
node.js内置模块之---crypto 模块
java
weyyhdke2 小时前
springboot和springframework版本依赖关系
java·spring boot·后端
chools3 小时前
Java后端拥抱AI开发之个人学习路线 - - Spring AI【第一期】
java·人工智能·学习·spring·ai
jeCA EURG4 小时前
Spring Boot 2.7.x 至 2.7.18 及更旧的版本,漏洞说明
java·spring boot·后端
BduL OWED4 小时前
Redis之Redis事务
java·数据库·redis