maven学习之pom.xml或settings.xml对nexus的配置(转)
(1)在POM中配置Nexus仓库
<project>
...
<repositories>
<repository>
<id>nexus</id>
<name>Nexus</name>
<url>http://localhost:8081/nexus/content/groups/public/<url>
<release><enabled>true</enabled></release>
<snapshots><enabled>true></enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus</name>
<url>http://localhost:8081/nexus/content/groups/public/<url>
<release><enabled>true</enabled></release>
<snapshots><enabled>true></enabled></snapshots>
</pluginRepository>
</pluginRepositories>
...
</project>
上述配置只对当前项目有效,若需让本机所有Maven项目均使用Mavne私服,应该在setting.xml中进行配置。
(2)在setting.xml中配置Nexus仓库
<settings>
...
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus</id>
<name>Nexus</name>
<url>http://localhost:8081/nexus/content/groups/public/<url>
<release><enabled>true</enabled></release>
<snapshots><enabled>true></enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus</name>
<url>http://localhost:8081/nexus/content/groups/public/<url>
<release><enabled>true</enabled></release>
<snapshots><enabled>true></enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfiles>
</activaProfiles>
</settings>
activeProfiles用来激活。
(3) 配置镜像让Maven只使用私服
<settings>
...
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*<?mirrorOf>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<name>http://central</name>
<release><enabled>true</enabled></release>
<snapshots><enabled>true></enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>http://central</name>
<release><enabled>true</enabled></release>
<snapshots><enabled>true></enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfiles>
</activaProfiles>
...
</settings>
只要mirrorOf中的工厂需要下载jar,都会自动来找该镜像。如果镜像地址有,就下载下来。若镜像地址没有,mirrorOf中的工厂也不会到中央资源库下载,而是由镜像去下载。这是推荐做法。若镜像下载不到,就下载失败。
maven学习之pom.xml或settings.xml对nexus的配置(转)的更多相关文章
- Maven学习存档(2)——settings.xml配置
二.settings.xml配置 2.1 原文 <?xml version="1.0" encoding="UTF-8"?> <!-- Lic ...
- Maven实战:pom.xml与settings.xml
pom.xml与settings.xml pom.xml与setting.xml,可以说是Maven中最重要的两个配置文件,决定了Maven的核心功能,虽然之前的文章零零碎碎有提到过pom.xml和s ...
- maven的几个重要配置文件pom.xml、settings.xml;Maven打包生成包含所有依赖的jar包
一个java项目通过maven自动下载依赖时,会涉级读取三个配置文件,分别是项目下的pom.xml 文件 .用户家目录下的.m2/settings.xml 与 maven 全局配置settings.x ...
- 【maven学习】pom.xml文件详解
环境 apache-maven-3.6.1 jdk 1.8 eclipse 4.7 POM是项目对象模型(Project Object Model)的简称,它是Maven项目中的文件,使用XML表示, ...
- Maven学习 六 pom.xml文件
java jar包的搜索网址:http://mvnrepository.com/ pom作为项目对象模型.通过xml表示maven项目,使用pom.xml来实现.主要描述了项目:包括配置文件:开发者需 ...
- 解决Maven提示:Could not read settings.xml, assuming default values
本文转载自:http://blog.csdn.net/hqocshheqing/article/details/47702049 最近在学习Maven 时总是出现 Could not read se ...
- 解决Maven提示:Could not read settings.xml
在Eclipse中配置maven时,提示错误:Could not read settings.xml.用户配置无法生效. 1.首先检查自己的settings.xml配置文件,发现在<!----& ...
- Maven入门-3.pom文件和settings文件
1.pom.xml文件介绍2.settings.xml文件介绍 1.pom.xml文件介绍 Maven项目的核心是pom.xml,pom(Project Object Model项目对象模型) pom ...
- maven学习7 settings.xml解析
maven的配置文件settings.xml存在于两个地方: 1.安装的地方:${M2_HOME}/conf/settings.xml 2.用户的目录:${user.home}/.m2/setting ...
随机推荐
- Javascript Module pattern template. Shows a class with a constructor and public/private methods/properties. Also shows compatibility with CommonJS(eg Node.JS) and AMD (eg requireJS) as well as in a br
/** * Created with JetBrains PhpStorm. * User: scotty * Date: 28/08/2013 * Time: 19:39 */ ;(function ...
- 科技论文之Latex公式&符号
近期在写文章.有好多数学公式的命令都忘记了. 今天索性一起整理下. 1 能够在文章的作者上引用的符号 2 一些括号使用方法 3 一些高等数学的公式 4 交,并集 5 一些二项式 6 矩阵写法 7 ...
- 对Faster R-CNN的理解(1)
目标检测是一种基于目标几何和统计特征的图像分割,最新的进展一般是通过R-CNN(基于区域的卷积神经网络)来实现的,其中最重要的方法之一是Faster R-CNN. 1. 总体结构 Faster R-C ...
- linux清除缓存
linux清除缓存:需要root权限$ sync$ echo 3 >/proc/sys/vm/drop_caches 上面的echo 3 是清理所有缓存 echo 0 是不释放缓存 echo 1 ...
- 【翻译】Nginx的HTTP负载均衡
本文为翻译文,原文地址:http://nginx.org/en/docs/http/load_balancing.html 介绍 将请求负载均衡到多个应用实例是一个常用的技术,它起到优化资源使用率.最 ...
- 【LeetCode】二叉搜索树的前序,中序,后续遍历非递归方法
前序遍历 public List<Integer> preorderTraversal(TreeNode root) { ArrayList<Integer> list = n ...
- Win10添加右键在此处打开命令行
通过添加注册表项,实现右击“在此处打开命令行功能” 注册表位置:HKEY_CLASSES_ROOT\Directory\Background\shell\ win10系统用标识右键菜单打开命令行的键, ...
- 【iCore4 双核心板_uC/OS-II】例程四:软件定时器
一.实验说明: 一些应用程序执行它们的任务时需要延迟一段特定的时间,因此uC/OS-II为我们提供了一些相应的 延时函数,本例程我们使用软件定时器定时500ms点亮相应的LED实现三色LED循环闪烁. ...
- 学习笔记:The Log(我所读过的最好的一篇分布式技术文章)
前言 这是一篇学习笔记. 学习的材料来自Jay Kreps的一篇讲Log的博文. 原文非常长.可是我坚持看完了,收获颇多,也深深为Jay哥的技术能力.架构能力和对于分布式系统的理解之深刻所折服.同一时 ...
- permutohedral lattice理解
[完结]saliency filters精读之permutohedral lattice 2012年09月28日 22:40:08 工长山 阅读数:12432 版权声明:本文为博主原创文章,未经 ...