配置Maven从私服下载构件
--------------------siwuxie095
配置
Maven
从私服下载构件
从
Nexus 私服下载构件的配置方法共有三种
1、法一:
在
pom.xml 的 project 标签中添加如下内容
<repositories> <repository>
<id>nexus</id> <name>Nexus</name> <url>http://localhost:8081/nexus/content/groups/public/</url>
<releases> <enabled>true</enabled> </releases>
<snapshots> <enabled>true</enabled> </snapshots>
</repository> </repositories>
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<pluginRepositories> <pluginRepository>
<id>nexus</id> <name>Nexus</name> <url>http://localhost:8081/nexus/content/groups/public/</url>
<releases> <enabled>true</enabled> </releases>
<snapshots> <enabled>true</enabled> </snapshots>
</pluginRepository> </pluginRepositories> |
注:分别配置仓库和插件仓库
2、法二:
(1)在
settings.xml 的 profiles 标签中添加如下内容
<profile>
<id>nexus</id> <repositories> <repository> <id>nexus</id> <name>Nexus</name> <url>http://localhost:8081/nexus/content/groups/public/</url>
<releases> <enabled>true</enabled> </releases>
<snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> <pluginRepositories> <pluginRepository> <id>nexus</id> <name>Nexus</name> <url>http://localhost:8081/nexus/content/groups/public/</url> <releases> <enabled>true</enabled> </releases>
<snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> |
注:使用
id 为 nexus 的 profile 分别配置仓库和插件仓库
(2)在
settings.xml 的 activeProfiles 标签中添加如下内容
<activeProfile>nexus</activeProfile> |
注:将
id 为 nexus 的 profile 激活
3、法三(建议):
(1)在
settings.xml 的 mirrors 标签中添加如下内容
<mirror> <id>nexus</id> <name>Nexus</name> <url>http://localhost:8081/nexus/content/groups/public/</url> <mirrorOf>*</mirrorOf> </mirror> |
注:配置一个匹配任何仓库的镜像,其地址为
Nexus 私服
(2)在
settings.xml 的 profiles 标签中添加如下内容
<profile>
<id>nexus</id> <repositories> <repository> <id>central</id> <name>Central</name> <url>http://central</url>
<releases> <enabled>true</enabled> </releases>
<snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <!-- ++++++++++++++++++++++++++ --> <pluginRepositories> <pluginRepository> <id>central</id> <name>Central</name> <url>http://central</url> <releases> <enabled>true</enabled> </releases>
<snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> |
注:使用
id 为 nexus 的 profile 分别配置仓库和插件仓库,
但仓库和插件仓库的
id 都为 central,这将覆盖超级 POM
中央仓库的配置,而 url 已无关紧要,因为所有的请求都会
通过镜像访问私服地址
配置仓库和插件仓库的主要目的是开启对快照版本构件下载
的支持
(3)在
settings.xml 的 activeProfiles 标签中添加如下内容
<activeProfile>nexus</activeProfile> |
注:将
id 为 nexus 的 profile 激活
附:
法一 |
针对当前 |
法二 |
针对所有 |
法三 |
针对所有 |
法二和法三虽然都可以一劳永逸,但法二除了从
Nexus 私服
下载构件之外,还会不时访问中央仓库
我们希望的是所有
Maven 下载请求都仅仅通过 Nexus 私服,
以全面发挥私服的作用,而法三刚好做到了这点
【made by siwuxie095】
配置Maven从私服下载构件的更多相关文章
- 配置maven从私服上下载构件
maven 本地setting.xml配置 <!--配置maven从私服上下载构件 --> <profiles> <profile> <repositorie ...
- Maven--配置 Maven 从 Nexus 下载构件
在 POM 中配置: <project> ... <repositories> <repository> <id>nexus</id> &l ...
- eclipse配置maven后无法下载jar
1.检查网络拦截是否正常 2.进入maven依赖库根目录搜索出该目录下的*lastUpdated.properties文件并删除 然后就可以继续下载jar包了
- NPM:如何配置maven npm私服
https://help.sonatype.com/repomanager3/quick-start-guide-proxying-maven-and-npm#QuickStartGuide-Prox ...
- IntelliJ IDEA及maven、git下载与配置
maven下载地址:http://maven.apache.org/download.cgi,下载bin文件然后解压 maven环境变量配置: MAVEN_HOME:D: \install\apac ...
- maven 搭建私服
博客参考 https://www.cnblogs.com/luotaoyeah/p/3791966.html 整理纯为技术学习 1 . 私服简介 私服是架设在局域网的一种特殊的远程仓库,目的是代理远程 ...
- J2EE走向成功路-02-Struts2 配置(Maven)
在上一篇中,介绍了使用jar包搭建Struts2框架,这一篇中来介绍一下在Maven环境下搭建Struts2框架,主要为配置Maven. 1.下载Maven,官网:http://maven.apach ...
- IntellIJ IDEA 配置 Maven 以及 修改 默认 Repository
转自:IntellIJ IDEA 配置 Maven 以及 修改 默认 Repository 今天将IntellIJ IDEA 关于Maven的配置总结一下,方便以后可参考. IDEA版本: Intel ...
- Eclipse 配置Maven以及修改默认Repository
今天将Eclipse关于Maven的配置总结一下,方便以后配置. 一.配置Maven环境 1.下载apache-maven文件,选择自己需要的版本,地址:http://mirrors.cnnic.cn ...
随机推荐
- 基于Vue的Ui框架
基于Vue的Ui框架 饿了么公司基于vue开的的vue的Ui组件库 Element Ui 基于vue pc端的UI框架 http://element.eleme.io/ MintUi 基于vue 移动 ...
- move操作
move一个表到另外一个表空间时,索引不会跟着一起move,而且会失效.(LOB类型例外) 表move,我们分为: *普通表move *分区表move *LONG,LOB大字段类型move来进行测试和 ...
- sqoop操作之ORACLE导入到HIVE
导入表的所有字段 sqoop import --connect jdbc:oracle:thin:@192.168.1.107:1521:ORCL \ --username SCOTT --passw ...
- CSS 背景background实例
css背景background用于设置html标签元素的背景颜色.背景图片已经其他背景属性.本文章向码农介绍CSS 背景background使用方法和基本的使用实例.需要的码农可以参考一下. 一.Cs ...
- 异步请求fetch之初体验
更好阅读体验可移步我的博客:Blog 导读 传递信息到服务器,从服务器获取信息,是前端发展的重中之重,尤其是现在前后端分离的大前提下,前后端的数据交互是前端的必修科目了.从很久之前到现在,ajax都是 ...
- hadoop分布式快速搭建
hadoop分布式快速搭建 1.配置主节点与从节点的ssh互信:[其中在主从节点主机的/etc/hosts文件中需绑定主机名ip间的映射关系; 如,192.168.1.113 node0 192.16 ...
- CUDA C Programming Guide 在线教程学习笔记 Part 5
附录 A,CUDA计算设备 附录 B,C语言扩展 ▶ 函数的标识符 ● __device__,__global__ 和 __host__ ● 宏 __CUDA_ARCH__ 可用于区分代码的运行位置. ...
- Ceph实战入门系列(一)——三节点Ceph集群的安装与部署
安装文档:http://blog.csdn.net/u014139942/article/details/53639124
- 【独家】完美解决appium安装app时,需要手动确认安装的问题
appium初始化driver时,如果未安装该app会先进行安装,安装时,很多安卓手机都会弹框,需要手动确认安装. 如小米的机器, 这是个头疼的问题,之前在网上找遍了,只有通过adb去点相对坐标成功了 ...
- leetcode27
public class Solution { public int RemoveElement(int[] nums, int val) { var len = nums.Length; ; ; i ...