maven 配置多个仓库的方法
作者:itprobie-菜鸟程序员 发布时间:2021-06-09 03:30:24
标签:maven,仓库,配置
1>方法一
之前在配置 Maven 的 settings.xml 时,都会设置 mirror 节点,例如:
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
然后第一想法就是在 mirrors 节点下多增加几个 mirror,然而并不可以。正确的操作是在 profiles 节点下配置多个 profile,而且配置之后要激活。例如:
配置profiles
<profiles>
<profile>
<id>boundlessgeo</id>
<repositories>
<repository>
<id>boundlessgeo</id>
<url>https://repo.boundlessgeo.com/main/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>aliyun</id>
<repositories>
<repository>
<id>aliyun</id>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>maven-central</id>
<repositories>
<repository>
<id>maven-central</id>
<url>http://central.maven.org/maven2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
<profiles>
通过配置 activeProfiles 子节点激活
<activeProfiles>
<activeProfile>boundlessgeo</activeProfile>
<activeProfile>aliyun</activeProfile>
<activeProfile>maven-central</activeProfile>
</activeProfiles>
如果在IDE里,记得要更新生效,然后就可以了。
2> 方法二
在项目中添加多个仓库,是通过修改项目中的pom文件实现的。
思路:在项目中pom文件的repositories节点(如果没有手动添加)下添加多个repository节点,每个repository节点是一个仓库。
<repositories>
<repository>
<!-- id必须唯一 -->
<id>jboss-repository</id>
<name>jboss repository</name>
<url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
</repository>
<repository>
<id>aliyun-repository</id>
<name>aliyun repository</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</repository>
<repository>
<id>奇葩仓库</id>
<url>https://奇葩仓库/public/</url>
</repository>
</repositories>
来源:https://www.cnblogs.com/guohu/p/12208094.html


猜你喜欢
- 该接口实现了序列化,声明为 public interface Key extends SerializableKey 是所有密钥的顶层接口。
- 随着互联网技术的发展,现在的网站架构基本都由原来的后端渲染,变成了:前端渲染、先后端分离的形态,而且前端技术和后端技术在各自的道路上越走越远
- 在上篇文章给大家介绍了Spring boot + mybatis + Vue.js + ElementUI 实现数据的增删改查实例代码(一)
- Unity中的PostProcessBuild:深入解析与实用案例在Unity游戏开发中,我们经常需要在构建完成后对生成的应用程序进行一些额
- 1. 场景描述本节结合springboot2、springmvc、mybatis、swagger2等,搭建一个完整的增删改查项目,希望通过这
- 在我们对gc中的算法有基本概念理解后,要把算法的理念实现还需要依托实际垃圾收集器的使用。因为光靠一些简单的原理不足以支撑整个程序的运行,在回
- 问题背景在最近的项目开发中遇到一个需求 需要对mysql做一些慢查询、大结果集等异常指标进行收集监控,从运维角度并没有对mysql进行统一的
- 本文实例介绍了sdcard存储图片下载简单操作,分享给大家供大家参考,具体内容如下步骤 -- 在配置清单添加完联网权限后1、res/layo
- 代码MyCalculator.h#pragma once#include <QtWidgets/QMainWindow>#inc
- 在Excel中,可对单元格中的字符串设置多种不同样式,通常只需要获取到单元格直接设置样式即可,该方法设置的样式会应用于该单元格中的所有字符。
- 小编今天研究了在Unity3D中的数据持久化问题。数据持久化在任何一个开发领域都是一个值得关注的问题,小到一个应用中配置文件的读写,大到数据
- @Lazy用于指定该Bean是否取消预初始化。主要用于修饰Spring Bean类,用于指定该Bean的预初始化行为,使用该Annotati
- 一、依赖注入(DI)依赖注入听起来很高深的样子,其实白话就是:给属性赋值。一共有两种方法,第一是以构造器参数的形式,另外一种就是以setti
- 本文实例讲述了Android编程实现自定义手势的方法。分享给大家供大家参考,具体如下:之前介绍过如何在Android程序中使用手势,主要是系
- 提到Excel的导入导出,大家肯定都知道alibaba开源的EasyExcel,该项目的github地址为:https://github.c
- 本文实例讲述了C#实现将DataTable内容输出到Excel表格的方法。分享给大家供大家参考。具体如下:1.关于本文本文描述了一个函数(S
- 在C++中,当你去创建一个类的时候,即便这个类是空类,也会自动生成下面6个默认成员函数,在本篇博客中,我将逐一分析下面6个默认成员函数。构造
- @RequestBody配合@Valid校验入参参数自定义一个Controllerimport com.example.demo.pojo.
- 作为工厂方法模式的孪生兄弟,相信大家对工厂方法模式和抽象工厂模式傻傻分不清楚吧。那么,就让我来拯救大家吧!抽象工厂模式定义:所谓抽象工厂模式
- 问题描述今天在给SpringBoot项目配置 * 的时候发现怎么都进不到 * 的方法里面,在搜索引擎上看了无数篇关于配置 * 的文章都没有找