---
title: "maven第三节-nexus私服功能介绍"
author: "xuehanxin"
date: "2016-02-13T15:53:52Z"
tags: []
categories: ["研发管理"]
slug: "maven-nexus"
draft: false
lastmod: "2016-02-13T15:57:34Z"
id: 2276273
url: "https://blueyan.iteye.com/blog/2276273"
---

1.nexus私服的安装  
  从官网下载nexus，加压到本地，修改D:\\installfile\\nexus\\nexus-2.12.0-01\\bin\\jsw\\conf\\wrapper.conf  
wrapper.java.command=D:\\Program Files\\Java\\jdk1.7.0\_79\\bin\\java  
到目录：D:\\installfile\\nexus\\nexus-2.12.0-01\\bin下  
nexus install  
nexus start启动，nexus stop停止，nexus这就这么启动关闭的，安装完毕  
2.nexus仓库的介绍  
A.host的仓库。内部项目的发布仓库

![](http://dl2.iteye.com/upload/attachment/0115/0632/0d0fb92a-0885-3d99-9895-7f21939d74bc.png)  
   
B.proxy的仓库。从远程中央仓库中寻找数据的仓库  
C.group仓库。组仓库用来方便开发人员进行设置的仓库  
D.一种virtus仓库(现在不理解)  
3.私服的使用  
这个也是nexus使用最多的功能，目的是我们每次下载jar包先从私服下载，私服如果不存在在从maven中央仓库下载  
A.设置镜像（设置setting.xml）

![](http://dl2.iteye.com/upload/attachment/0115/0634/36bac1e7-48a1-34da-abb4-a30cf253d981.bmp)  
   
B.在settings.xml配置仓库，此时本机中的所有maven项目都会去私有仓库中查询依赖

![](http://dl2.iteye.com/upload/attachment/0115/0636/1e18e80a-ab96-3ad1-917b-0a618ad31c2b.bmp)  
   
4.项目发布  
需要在pom文件里配置

```
<distributionManagement>
		<snapshotRepository>
			<id>snapshots</id>
			<url>http://localhost:8081/nexus/content/repositories/snapshots</url>
		</snapshotRepository>
	</distributionManagement>
```

   
同时在setting.xml文件里配置

```
<server>   
   <id>snapshots</id>   
   <username>admin</username>   
   <password>admin123</password>   
</server> 
```

 

id即为发布到的工厂仓库 Repository ID  
5.创建项目工厂，创建权限角色(略)