1.各个仓库介绍

Hosted:宿主仓库

主要放本公司开发的SNAPSHOTS测试版本,RELEASES正式发行版。合作公司第三方的jar包。

Proxy:代理仓库

代理中央仓库;代理Apache下测试版本jar包

Group:组仓库

  存放各种仓库(宿主仓库,代理仓库)

Virtual:虚拟仓库(废弃)

代理maven1版本的jar包

2.组仓库可进行配置,存放那个仓库(配置后 通过组仓库即可访问配置过的仓库)

3.maven中私服的配置

jar包上传配置

setting.xml中的配置

<server>
<!-- 发布的位置在POM中配置,以ID为关联,有很多公用的信息需要配置在POM文件里,最佳实践是定义一个公司级别的root pom -->
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server> 项目pom.xml配置 <!-- 分配 -->
<distributionManagement>
<repository>
<id>releases</id>
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>

4.jar包下载配置

setting.xml配置

<!-- 自定义本地仓库地址,其默认值为~/.m2/repository
<localRepository>/data/maven-repository</localRepository>
-->
<!-- 发布的服务器和密码,暂时未限制权限 -->
<servers>
<server>
<!-- 发布的位置在POM中配置,以ID为关联,有很多公用的信息需要配置在POM文件里,最佳实践是定义一个公司级别的root pom -->
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>thirdparty</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
 <!-- 配置镜像 -->
<mirrors>
<mirror>
<!-- 此镜像一般用来作为公司内部开发的版本快照,作为public-snapshots仓库的镜像地址 -->
<!-- 镜像的id,id用来区分不同的mirror元素。 -->
<id>nexus-public-snapshots</id>
<!-- 被镜像的服务器的id。例如,如果我们要设置了一个Maven中央仓库(http://repo1.maven.org/maven2)的镜像,
就需要将该元素设置成central。这必须和中央仓库的id “central”完全一致。 -->
<mirrorOf>public-snapshots</mirrorOf>
<!-- 该镜像的URL。 -->
<url>http://192.168.10.92:8081/nexus/content/groups/public-snapshots</url>
</mirror> <mirror>
<!-- 此镜像一般用来作为公司第三方引用基础类库镜像,是所有仓库的镜像地址 -->
<id>nexus</id>
<!-- 为*表示为所有的仓库做镜像,有了这个配置,所有的构建都会包含public组,如果你想包含public-snapshots组,
你必须添加public-snapshots这个Profile,通过在命令行使用如下的 -P 标志:$ mvn -P public-snapshots clean install -->
<mirrorOf>*</mirrorOf>
<url>http://192.168.10.92:8081/nexus/content/groups/public</url>
</mirror>
</mirrors> <!-- settings.xml中的profile元素是pom.xml中profile元素的裁剪版本。它包含了activation, repositories, pluginRepositories 和 properties元素。
这里的profile元素只包含这四个子元素是因为这里只关心构建系统这个整体(这正是settings.xml文件的角色定位),而非单独的项目对象模型设置。
如果一个settings中的profile被激活,它的值会覆盖任何其它定义在POM中或者profile.xml中的带有相同id的profile。 -->
<profiles>
<profile>
<id>development</id>
<!-- 仓库。仓库是Maven用来填充构建系统本地仓库所使用的一组远程项目。而Maven是从本地仓库中使用其插件和依赖。
不同的远程仓库可能含有不同的项目,而在某个激活的profile下,可能定义了一些仓库来搜索需要的发布版或快照版构件。有了Nexus,这些应该交由Nexus完成 -->
<repositories>
<repository>
<id>central</id>
<!-- 虚拟的URL形式,指向镜像的URL,因为所有的镜像都是用的是nexus,这里的central实际上指向的是http://repos.d.xxx.com/nexus/content/groups/public -->
<url>http://central</url>
<!-- 表示可以从这个仓库下载releases版本的构件-->
<releases><enabled>true</enabled></releases>
<!-- 表示可以从这个仓库下载snapshot版本的构件 -->
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories> <!-- 插件仓库。仓库是两种主要构件的家。第一种构件被用作其它构件的依赖。这是中央仓库中存储大部分构件类型。
另外一种构件类型是插件。Maven插件是一种特殊类型的构件。由于这个原因,插件仓库独立于其它仓库。
pluginRepositories元素的结构和repositories元素的结构类似。每个pluginRepository元素指定一个Maven可以用来寻找新插件的远程地址。 -->
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile> <profile>
<!--this profile will allow snapshots to be searched when activated-->
<id>public-snapshots</id>
<repositories>
<repository>
<id>public-snapshots</id>
<!-- 虚拟的URL形式,指向镜像的URL,这里指向的是http://repos.d.xxx.com/nexus/content/groups/public-snapshots -->
<url>http://public-snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public-snapshots</id>
<url>http://public-snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles> <!-- 激活的Profile。activation元素并不是激活profile的唯一方式。settings.xml文件中的activeProfile元素可以包含profile的id,
任何在activeProfile中定义的profile id,不论环境设置如何,其对应的profile都会被激活。如果没有匹配的profile,则什么都不会发生。
profile也可以通过在命令行,使用-P标记和逗号分隔的列表来显式的激活(如,-P test)。
要了解在某个特定的构建中哪些profile会激活,可以使用maven-help-plugin(mvn help:active-profiles)。 -->
<activeProfiles>
<!-- 没有显示激活public-snapshots -->
<activeProfile>development</activeProfile>
</activeProfiles>

maven私服搭建nexus介绍(二)的更多相关文章

  1. window Maven私服搭建——nexus

    注:本文来源于 <window   Maven私服搭建--nexus> Maven私服搭建--nexus 1.下载nexus https://www.sonatype.com/downlo ...

  2. maven私服搭建nexus/windows/linux(一)

    为什么要搭建nexus私服,原因很简单,有些公司都不提供外网给项目组人员,因此就不能使用maven访问远程的仓库地址,还有就是公司内部开发的一些版本的jar包,如果没有私服需要一人拷贝一份然后再自己安 ...

  3. Maven私服搭建(Nexus Repository Manager 3)

    下载和安装 下载地址:https://help.sonatype.com/repomanager3/download 注意:Nexus Repository Manager 3是一个Java服务器应用 ...

  4. Linux安装配置maven以及搭建nexus私服(编写启动脚本)

    2011年07月12日16:32  下面介绍在Linux操作系统下安装配置maven和搭建nexus私服. 一.安装前的准备 下载 jdk http://www.oracle.com/technetw ...

  5. maven私服搭建

    一.软件安装 地址:http://www.sonatype.org/nexus/thank-you-for-downloading/?dl=tgz 解压: 启动: >> nexus sta ...

  6. maven仓库总结,maven私服搭建

    配置pom.xml依赖包时在这里找包的描述: http://search.maven.org/#browse 以java为根目录. mvn archtype:generate -DgroupId=zt ...

  7. maven仓库总结,maven私服搭建,批量mvn eclipse:eclipse

    配置pom.xml依赖包时在这里找包的描述: http://search.maven.org/#browse 以java为根目录. mvn archtype:generate -DgroupId=zt ...

  8. maven私服搭建&使用

    Maven私服搭建教程 一.nexus安装 1,解压安装包 安装包下载地址 2,以管理员身份打开cmd 3,进入到nexus的bin目录 (1) 安装:nexus install (2) 启动:nex ...

  9. maven私服搭建(centOS6.5)

    maven的好处和私服的应用本文不赘述,私服搭建如下: MAVEN 私服搭建(centOS 6.5 环境) 1.  准备环境,搭建centOS6.5系统环境,略 2.  准备对应的软件包如下: A. ...

随机推荐

  1. 对JavaScript中变量类型的重新理解

    <JavaScript启示录>这本书中提出:JavaScript中,对象为“王”(JavaScript里的几乎所有东西都是对象或者用起来像对象). 飞燕草对JavaScript最深刻的理解 ...

  2. UI培训自学能学好吗

    近年来UI设计师愈来愈红,成为行业热门,越来越多的人开始专注UI培训,也有一部分人在考虑,培训班一般价格不菲,我自学怎么样呢? UI设计是指人机交互过程中的一个界面设计,常用到的有 ps和ai两个工具 ...

  3. 徒手用Java来写个Web服务器和框架吧<第一章:NIO篇>

    因为有个不会存在大量连接的小的Web服务器需求,不至于用上重量级服务器,于是自己动手写一个服务器. 同时也提供了一个简单的Web框架.能够简单的使用了. 大体的需求包括 能够处理HTTP协议. 能够提 ...

  4. Pdf File Writer 中文应用(PDF文件编写器C#类库)

    该文由小居工作室(QQ:2482052910)    翻译并提供解答支持,原文地址:Pdf File Writer 中文应用(PDF文件编写器C#类库):http://www.cnblogs.com/ ...

  5. Spring学习笔记①

    我觉得Spring之所以发展的好,主要是理论研究与实践是并轨的,能跟得上时代的步伐,尤其是基础理论的研究(可能是最近看三体看多了,对基础理论非常崇拜).微服务的实现啊,RESTful的实现,对应的Sp ...

  6. 1709: [Usaco2007 Oct]Super Paintball超级弹珠

    1709: [Usaco2007 Oct]Super Paintball超级弹珠 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 339  Solved:  ...

  7. mysql 修改数据库data存放位置

    一.首先把mysql的服务先停掉. 二.更改MySQL配置文件My.ini中的数据库存储主路径 打开MySQL默认的安装文件夹C:\Program Files\MySQL\MySQL Server 5 ...

  8. 前端总结·基础篇·JS(二)数组深拷贝、去重以及字符串反序和数组(Array)

    目录 这是<前端总结·基础篇·JS>系列的第二篇,主要总结一下JS数组的使用.技巧以及常用方法. 一.数组使用 1.1 定义数组 1.2 使用数组 1.3 类型检测 二.常用技巧 2.1 ...

  9. 为什么用IP无法访问网站,域名可以访问?

    我们访问网站都是通过域名进行访问的,偶尔会使用网站IP进行访问,如学校通常使用IP登录教务处,但很多的时候我们无法通过ip进行访问其他网站,这就涉及到服务器的问题了. 网站都是依托在服务器上面的,而服 ...

  10. SQLSERVER 切换数据库为单用户和多用户模式

    有时候数据库在占用时,想做一些操作,无法操作.可以尝试将数据库切换为单用户模式来操作.操作完之后再切换回多用户模式. 命令如下: alter database 数据库名 set Single_user ...