在Maven中设置Nexus私有服务为中央工厂


版权声明:本文为博主原创文章,未经博主允许不得转载。
nexus中的仓库列表
第一种方式:
<repositories>
<repository>
<id>nexus</id>
<name>nexus Repository</name>
<url>http://localhost:8081/nexus/content/repositories/central/</url>
</repository>
</repositories>
这种方式,Maven仅仅只会在nexus中的central中央工厂进行下载,而我们希望我们开发的releases、snapshots工厂都能下载
而这种方式会增加配置的复杂度,并且增加了配置文件的冗余,而没增加一个都会去添加,这种方式不推荐使用
第二种方式:
为解决第一种方式,在nexus中提供了另外一种方式仓库为:Public Repositories 类型为group Repository Path为:http://localhost:8081/nexus/content/groups/public/
的方式
在pom.xml中我们只需要将url地址更改成它的地址即可,用了这个工厂就相当于用了Releases、Snapshots、3rd party 、Central这几个工厂
<repositories>
<repository>
<id>nexus</id>
<name>nexus Repository</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</repository>
</repositories>
设置了之后,当我们有新的依赖,它就回去nexus中的仓库中去下载
第二种方式,当还一个模块的时候还的配置,这样就不太方便,在企业开发中,我们需要设置一个共有的,因此第三中方式就来了
第三种方式
将自己设置的工厂中的settings.xml进行配置
<profiles>
<profile>
<id>nexusRepository</id>
<repositories>
<repository>
<id>nexus</id>
<name>nexus is Repository</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<!-- 默认就是true -->
<releases>
<enabled>true</enabled>
</releases>
<!-- 默认是是false,需手动打开 设置为true -->
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<!-- 这里必须激活profile 才能生效 -->
<activeProfiles>
<activeProfile>nexusRepository</activeProfile>
</activeProfiles>
这样默认也是从nexus repository下载
第三种方式在nexus服务器停止的了,maven有会从maven的中央工厂mvnrepository进行下载,这是因为,Maven项目首先回去nexus中去找,当它发现nexus服务停止这个时候它就回去找Maven的工厂
在Maven的安装包中的lib中的maven-model-builder-3.3.9.jar中的pom.xml,起配置如下
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
问题就是当我们发现Nexus服务停止了就不能下载,而只能从Nexus中下载,不允许去Maven中下载这就需要第四种方式
第四种方式:配置镜像
配置如下
<mirrors>
<mirror>
<id>mirrorNexusId</id>
<!-- *号代表所有工厂镜像 ,当Maven进来之后,不管什么工厂都回去找URL的地址去下载 -->
<mirrorOf>*</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</mirror>
</mirrors>
<!-- 这里的工厂配置,是Maven中的,起snapshots是false,我们可以通过这种方式将其激活,就可以访问中央工厂中snapshots -->
<profiles>
<profile>
<id>nexusRepository</id>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<!-- 这里必须激活profile 才能生效 -->
<activeProfiles>
<activeProfile>nexusRepository</activeProfile>
</activeProfiles>
第四种方式就是我们推荐的一种方式
在Maven中设置Nexus私有服务为中央工厂的更多相关文章
- 在Maven中设置Nexus私有服务为中央工厂(repository)
原文:http://blog.csdn.net/mexican_jacky/article/details/50275695 nexus中的仓库列表 第一种方式: <repositories&g ...
- Linux中设置服务自启动的三种方式
有时候我们需要Linux系统在开机的时候自动加载某些脚本或系统服务 主要用三种方式进行这一操作: ln -s 在/etc/rc.d/rc*.d目录中建立/e ...
- [转]Linux中设置服务自启动的三种方式
from:http://www.cnblogs.com/nerxious/archive/2013/01/18/2866548.html 有时候我们需要Linux系统在开机的时候自动加载某些脚本或系统 ...
- (转)Linux中设置服务自启动的三种方式
有时候我们需要Linux系统在开机的时候自动加载某些脚本或系统服务 主要用三种方式进行这一操作: ln -s 在/etc/rc.d/rc*.d目录中建立/e ...
- 【转发】Linux中设置服务自启动的三种方式
有时候我们需要Linux系统在开机的时候自动加载某些脚本或系统服务 主要用三种方式进行这一操作: ln -s 在/etc/rc.d/rc*.d目录中建立/e ...
- window Maven私服搭建——nexus
注:本文来源于 <window Maven私服搭建--nexus> Maven私服搭建--nexus 1.下载nexus https://www.sonatype.com/downlo ...
- Nexus 私有仓库搭建与 Maven 集成
Nexus 私有仓库搭建与 Maven 集成 |作者:RexFang |出处:http://www.cnblogs.com/rexfang/ |关于作者:Java 程序员一枚 |版权:本文版权归作者和 ...
- 3.发布Maven项目到nexus中
1.在pom.xml文件中配置需要发布的工厂 如果想把项目发布到nexus中,需要在pom.xml中配置releases和snapshots版本发布的具体repository <distribu ...
- Linux中设置服务自启动的三种方式,ln -s 建立启动软连接
有时候我们需要Linux系统在开机的时候自动加载某些脚本或系统服务(http://www.0830120.com) 主要用三种方式进行这一操作: ln -s 在/etc/rc.d/rc*.d目录中建立 ...
随机推荐
- python实践
https://www.cnblogs.com/smallSevens/p/10016045.html --二手房交易记录 https://www.cnblogs.com/xiangyuecn/p/1 ...
- .Net Core添加分布式Session
一.Session HTTP是一个无状态协议,Web服务器将每一个请求都视为独立请求.并且不保存之前请求中用户的值. Session 状态是ASP.NET Core提供的一个功能,它可以在用户通应用访 ...
- EmguCV学习——视频与图片互转
其实视频转图片在上篇文章中已经有些眉目了,其实就是按帧读取视频,然后把帧保存就ok.然后自己再加个进度条美化一下...这代码简单易懂,还是直接上代码吧. 视频转图片 /// <summary&g ...
- 轻量数据库SQLiteDataBase的相关操作方法
一.查询操作: 查询操作比较复杂,主要有如下操作: db.rawQuery(String sql, String[] selectionArgs); db.query(String table, St ...
- windows下react-native搭建环境
第一步:安装Java 1.下载JDK,选择适应自己的机型:官网地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downl ...
- IOS 监控网络变化案例源码
随着移动网络升级:2G->3G->4G甚至相传正在研发的5G,网络速度是越来越快,但这流量也像流水一般哗哗的溜走. 网上不是流传一个段子:睡觉忘记关流量,第二天房子就归移动了! 这固然是一 ...
- Windows-Server-2008、IIS7.0环境下配置伪静态化
在Windows-Server-2008.IIS7.0环境下配置伪静态化 首先,是IIS7.0的配置,由于Windows Server 2008操作系统默认的IIS版本为 ...
- ROS:ubuntuKylin17.04-Ros使用OrbSLAM2
忙于图像处理和DCNN,很长时间不使用ROS,重新安装系统后,再次使用ORB-SLAM2(ROS)进行三维重建和实时追踪的演示. 参考以前的文章:ROS:ubuntu-Ros使用OrbSLAM ORB ...
- php xss 函数
function xss($string) { if (is_array($string)||is_object($string)||is_resource($string)) { return '' ...
- 【sqli-labs】 less28a GET- Blind based -All you Union&Select Belong to us -String -Single quote-parenthesis(GET型基于盲注的去除了Union和Select的单引号带括号字符型注入)
和less28没什么区别,直接上个payload吧 http://192.168.136.128/sqli-labs-master/Less-28a/?id=0')%a0uNion%a0sElect% ...