---
title: "nexus2.6.2 安装教程"
author: "projecttian"
date: "2013-10-08T22:16:21Z"
tags: ["maven", "nexus"]
categories: ["编程语言"]
slug: "nexus2-6-2"
draft: false
lastmod: "2013-10-08T22:18:38Z"
id: 1953464
url: "https://projecttian.iteye.com/blog/1953464"
---

简言：

Nexus是Maven仓库管理器,目的是搭建一个本地仓库服务器，其实就是在公司局域网中设置一个可以供内部下载到maven 数据的服务器，这样的好处是节省网络资源，速度快，可以通过nexus对项目的零时版本管理，来进行模块间的依赖开发，也可以自己发布一些资源来共享。

 

1.安装

网址：[http://www.sonatype.org/nexus/](http://www.sonatype.org/nexus/)下载

 

我的是win7系统所以下载nexus zip就ok。  
![](http://dl2.iteye.com/upload/attachment/0089/9548/f19b75f9-fd7e-3891-9e4d-b8d757da1600.jpg)  
 在2.5版本之后的nexus支持的jdk必须在7之后，所以你要去下载最新的jdk。或这直接更新你本机的jdk。

[]()[]()在2.5版本之后的nexus支持的jdk必须在7之后，所以你要去下载最新的jdk。或这直接更新你本机的jdk。

 

win7中----》控制面板------》java32位看到这个图标点击，弹出窗口，在更新tab页中更新就ok。

![](http://dl2.iteye.com/upload/attachment/0089/9550/8a75e4ae-d563-3d68-b9af-52dfaf03238b.jpg)  
 

下载后的文件：neus-2.6.2-01-bundle.zip随便解压到一个地方就ok。在{base}/bin/ jswx下面有安装和启动nexus的脚步目录，选择对应你系统的目录。我的是windows-x86-64.

这里主要看你的jdk安装的版本，如果jdk安装的是64的那么就选择64位，如果是32就选择32为，应该是这样的。

首先安装右键点击install-nexus.bat管理员运行（记住一定是管理员运行），然后右键点击start-nexus.bat 。

 

下载验证是否运行正常，浏览器中输入：http://localhost:8081/nexus/ ,8081是nexus的默认端口号。如果没有运行起来，那么你需要去查看{base}/log目录下的日志信息了。

 

 

![](http://dl2.iteye.com/upload/attachment/0089/9552/74faff72-e837-3bd3-979a-191b7c6265d3.jpg)![](http://dl2.iteye.com/upload/attachment/0089/9554/3ed68792-b813-3a36-b954-91990c288392.jpg)

 

 

 

 

 

 

 

 

 

 

 

 

2.现在来说一下如何使用，来构建自己的局域网数据仓库。

 

在页面的右上角，有log in 登陆按钮，默认的登陆用户名密码是 admin admin123

 

![](http://dl2.iteye.com/upload/attachment/0089/9556/53a43556-e730-3e61-9ee4-7dbd650f2a72.jpg)  
   
 数据仓库分为三种：proxy,host,group

central 是 apache的数据仓库,下图是它的设置，修改dowload remote indexes 为true  
![](http://dl2.iteye.com/upload/attachment/0089/9558/d0f4aba2-df81-3274-9d0c-7cb5e4d7bbce.jpg)  
 项目pom.xml中添加：

 

 

```
    <!-- 配置部署的远程仓库-->
    <distributionManagement>
        <snapshotRepository>
                <id>nexus-snapshots</id>
                <name>nexus distribution snapshot repository</name>
                <url>http://192.168.248.129:8081/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>
```

 

 

修改setting.xml：

```
<servers>
         <server> 
        <id>nexus-snapshots</id> 
        <username>admin</username> 
        <password>admin123</password> 
    </server>
</servers>
<profiles>
         <profile>
        <id>dev</id>
           <repositories>
              <repository>
                  <id>nexus</id>
                  <url>http://192.168.248.129:8081/nexus/content/groups/public/</url>
                  <releases>
                     <enabled>true</enabled>
                  </releases>
                  <snapshots>
                     <enabled>true</enabled>
                  </snapshots>
               </repository>
             </repositories>           
             <pluginRepositories>
                 <pluginRepository>
                     <id>nexus</id>
                     <url>http://192.168.248.129:8081/nexus/content/groups/public</url>
                     <releases>
                         <enabled>true</enabled>
                     </releases>
                     <snapshots>
                         <enabled>true</enabled>
                    </snapshots>
                 </pluginRepository>
             </pluginRepositories>
         </profile>
     </profiles>
          <activeProfiles>
         <activeProfile>dev</activeProfile>
     </activeProfiles>
```