---
title: "nexus 初试笔记"
author: "yonlist"
date: "2012-06-27T22:01:35Z"
tags: []
categories: ["行业应用"]
slug: "nexus"
draft: false
lastmod: "2012-07-08T14:51:30Z"
id: 1569410
url: "https://yonlist.iteye.com/blog/1569410"
---

今天花了点时间研究了下Nexus，做个小笔记。

 

1.别忘了登录 =..= 默认为admin/admin123；

 

2.修改proxy类型的仓库配置，将Download Remote Indexes改为True，save后会下载索引比较慢；

 

3.修改Public Repositories的配置，选几个仓库组合，然后就用这个仓库组的url了；

 

4.本机的maven/conf/setting.xml要加2段配置：

=======================================================

&lt;settings&gt;

...

&lt;mirrors&gt;

 

&lt;mirror&gt;

&lt;id&gt;nexus&lt;/id&gt;

&lt;mirrorOf&gt;\*&lt;/mirrorOf&gt;

&lt;url&gt;http://&lt;address&gt;:8081/nexus/content/groups/public&lt;/url&gt;

&lt;/mirror&gt;

&lt;/mirrors&gt;

 

&lt;profiles&gt;

&lt;profile&gt;

&lt;id&gt;nexus&lt;/id&gt;

&lt;repositories&gt;

&lt;repository&gt;

&lt;id&gt;central&lt;/id&gt;

&lt;url&gt;http://central&lt;/url&gt;

&lt;releases&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/releases&gt;

&lt;snapshots&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/snapshots&gt;

&lt;/repository&gt;

&lt;/repositories&gt;

&lt;pluginRepositories&gt;

&lt;pluginRepository&gt;

&lt;id&gt;central&lt;/id&gt;

&lt;url&gt;http://central&lt;/url&gt;

&lt;releases&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/releases&gt;

&lt;snapshots&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/snapshots&gt;

&lt;/pluginRepository&gt;

&lt;/pluginRepositories&gt;

&lt;/profile&gt;

 

  &lt;activeProfiles&gt;

&lt;activeProfile&gt;nexus&lt;/activeProfile&gt;

  &lt;/activeProfiles&gt;

&lt;/settings&gt;

=======================================================

如果不改这个也可以，改项目POM，添加：

&lt;project&gt;

...

 

&lt;repositories&gt;

&lt;repository&gt;

&lt;snapshots&gt;

&lt;enabled&gt;true&lt;/enabled&gt;

&lt;/snapshots&gt;

&lt;id&gt;public&lt;/id&gt;

&lt;name&gt;Public Repositories&lt;/name&gt;

&lt;url&gt;http://192.168.1.100:8081/nexus/content/groups/public/&lt;/url&gt;

&lt;/repository&gt;

&lt;/repositories&gt;

&lt;pluginRepositories&gt;

&lt;pluginRepository&gt;

&lt;id&gt;public&lt;/id&gt;

&lt;name&gt;Public Repositories&lt;/name&gt;

&lt;url&gt;http://192.168.1.100:8081/nexus/content/groups/public/&lt;/url&gt;

&lt;/pluginRepository&gt;

&lt;/pluginRepositories&gt;

 

&lt;dependencies&gt;

...

&lt;/project&gt;

=======================================================

 

5.用mvn help:system试试，项目目录下的mvn clean compile...一堆命令试试；

 

6.如果有获取之类的问题，确认下仓库的Remote Storage Location。我就是这里费了不少力气，不知道是不是网络不给力。

 

=======================================================

后记：我发现在网通网络连接中央仓库经常失败，电信网络基本没问题，这上面折腾了不少时间，同学们别走弯路了。