maven setting 多仓库配置
文章目录
- 前言
- 一 、setting文件
- 二、其他问题
前言
maven setting 通常公司都有私服地址,但不是所有包私服上都有,这时就要用阿里云或者其他地址去拉包。
那么我们可以直接设置setting 使其拉包时第一个地址拉取不到自动到第二个地址拉取以此类推可设置多个仓库地址进行补充。
一 、setting文件
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/settings-1.0.0.xsd"><localRepository>D:\software\dev\apache-maven-3.6.3\Repositories</localRepository><pluginGroups></pluginGroups><proxies></proxies><servers></servers><mirrors></mirrors><profiles><profile><id>aliyun</id> <repositories><repository><id>aliyun</id> <url>https://maven.aliyun.com/repository/public</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled> <updatePolicy>always</updatePolicy></snapshots></repository></repositories></profile><profile><id>private</id><repositories><repository><id>maven-releases</id><name>User Porject Release</name><url>http://私服地址/nexus/repository/maven-releases/</url><snapshots><enabled>false</enabled></snapshots><releases><enabled>true</enabled></releases></repository><repository><id>maven-snapshots</id><name>User Porject Snapshot</name><url>http://私服地址/nexus/repository/maven-snapshots/</url><snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots></repository><!-- 也可以把阿里云等仓库地址直接在这里补充 --><repository><id>com.e-iceblue</id><name>e-iceblue</name><url>http://repo.e-iceblue.cn/repository/maven-public/</url></repository></repositories></profile>
<!-- <profile>-->
<!-- <id>repo1</id>-->
<!-- <repositories>-->
<!-- <repository>-->
<!-- <id>repo1</id>-->
<!-- <url>https://repo1.maven.org/maven2</url>-->
<!-- <releases>-->
<!-- <enabled>true</enabled>-->
<!-- </releases>-->
<!-- <snapshots>-->
<!-- <enabled>true</enabled>-->
<!-- <updatePolicy>always</updatePolicy>-->
<!-- </snapshots>-->
<!-- </repository>-->
<!-- </repositories>-->
<!-- </profile>-->
<!-- <profile>-->
<!-- <id>repo2</id>-->
<!-- <repositories>-->
<!-- <repository>-->
<!-- <id>repo2</id>-->
<!-- <url>https://repo2.maven.org/maven2</url>-->
<!-- <releases>-->
<!-- <enabled>true</enabled>-->
<!-- </releases>-->
<!-- <snapshots>-->
<!-- <enabled>true</enabled>-->
<!-- <updatePolicy>always</updatePolicy>-->
<!-- </snapshots>-->
<!-- </repository>-->
<!-- </repositories>-->
<!-- </profile>--></profiles><activeProfiles><activeProfile>aliyun</activeProfile><activeProfile>private</activeProfile>
<!-- <activeProfile>repo1</activeProfile>-->
<!-- <activeProfile>repo2</activeProfile>--></activeProfiles>
</settings>
二、其他问题
- maven 默认有一个setting文件,如果我们的setting文件有很多,而默认setting中的mirror 直接指定了仓库路径,此时无论引用哪个setting文件,都会首先到默认setting内指定的仓库中拉取。
如下图所示,我的默认setting文件如此设置后,我指定了另外的setting文件,但是他会去D:\software\dev\apache-maven-3.6.3\Repositories\hlj路径下寻包,寻找不到直接报错Could not find artifact xxx in public (file://D:\software\dev\apache-maven-3.6.3\Repositories\hlj)
,最好只保留一个setting文件。
maven setting 多仓库配置相关推荐
- maven setting.xml 中文配置详解(全配置)
<?xml version="1.0" encoding="UTF-8"?> <!--| 官方文档: https://maven.apache ...
- Docker JFrog Artifactory 7.27.10 maven私服(仓库配置篇)
文章目录 一. 二. 建立远程仓库 2.1. 仓库列表 2.2. 仓库创建演示 2.3. 阿里云仓里调整 三.建立本地仓库 3.1. 仓库列表 3.2. 仓库创建演示 四.创建虚拟库 4.1. 仓库列 ...
- maven工程私服仓库配置(阿里云仓库)
1.首先在maven的配置文件中添加阿里云镜像 在setting.xml文件中添加 <mirrors> <mirror> <id& ...
- Maven修改远程仓库配置
Maven 默 认 的 远 程 中 央 仓 库 下 载 资 源 , 地 址 可 以 在 D:apache-mavenlibmaven-model-builder-3.3.9.jar 包中的 pom-4 ...
- 2022.09.01 最新配置maven阿里云仓库配置
阿里云最新的中央仓库地址及具体配置,之前的配置不能用了,在这里做下笔记留备份. 在maven的settings.xml文件中配置(idea默认c:users→[你的用户]→.m2→settings.x ...
- maven阿里云仓库配置
配置maven私服 在mirrors节点中新增mirror节点: <mirror><id>alimaven</id><mirrorOf>central& ...
- Maven Setting文件详细配置
<?xml version="1.0" encoding="UTF-8"?><!-- Licensed to the Apache Softw ...
- maven仓库配置及搜索顺序
文章目录 1. maven 仓库配置方式 1.1 maven setting.xml 文件配置 1.2 应用 pom.xml 仓库配置方式 2. maven 仓库搜索优先级 1)maven 仓库搜索路 ...
- maven讲解1:maven插件下载安装、环境变量配置、仓库配置
前言:idea或eclipse工具想要开发maven项目时,本地电脑需要下载并安装好maven插件. 另一个前置条件:本地电脑上JDK安装好了 一.下载maven插件 步骤1: 打开maven官网:h ...
最新文章
- Cytoscape: MCODE增强包的网络模块化分析
- (原创)用讯飞语音实现人机交互的功能
- Interview:算法岗位面试—11.17下午上海某网**软件公司(上市)技术面之比赛考察、目标检测算法、视频分析算法考点
- 编程中函数的返回值的定义问题的解决
- 通过OWA修改密码,提示输入的密码不符合最低安全要求
- appengine_Google AppEngine:任务队列API
- A+B Problem(V)
- linux远程计算,如何使用Linux应用服务器场的远程计算?
- Transfomer入门:Self-attention + Multi-head Self-attention
- uva 10891 - Game of Sum
- 图像超分辨率增强ESRGAN运行教程,有数据
- php 函数内临时变量,在PHP中调用函数时使用临时变量
- yolov5 简单教程
- 解决应用程序无法正常启动0xc0150002等问题
- 排序算法伪代码以及python实现——插入,归并,快速,堆,计数
- Qt报错 error: C1083
- 图像的二维频谱图的理解 20170622
- 挑战杯课外学术参赛作品—AI合约问卷调查系统
- spring boot Java 视频转换:avi转mp4
- 团队协作的三个基本要素——分工 合作 监督