Nexus的简单使用

本文介绍如何在Windows和RedHat系统上安装Nexus仓库管理器,并配置Maven以使用本地Nexus仓库。此外,还介绍了如何启用远程索引下载、配置代理仓库以及上传Artifact。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Nexus的简单使用

首页
http://nexus.sonatype.org/

参考文档官方
http://www.sonatype.com/books/nexus-book/reference/

参考BLOG
http://www.blogjava.net/aoxj/archive/2008/09/06/227453.html

下载地址
http://nexus.sonatype.org/downloads/

得到文件
nexus-webapp-1.3.6-bundle.zip
nexus-webapp-1.3.6-bundle.tar.gz

1、WINDOWS上安装
可执行文件在%nexus安装目录
D:\soft\nexus-webapp-1.3.6-bundle\nexus-webapp-1.3.6\bin\jsw\windows-x86-32
下:
InstallNexus.bat/UninstallNexus.bat是安装/卸载nexus为windows service,如果需要设置nexus为开机自动启动就可以安装为windows service然后设置启动方式为自动。
Nexus.bat是直接在命令行中启动Nexus,如果不想安装Nexus为windows service,可以用这个文件来手工控制Nexus的启动退出。

2、redhat安装
tar zxvf nexus-webapp-1.3.6-bundle.tar.gz
mv nexus-webapp-1.3.6/ /usr/local/
cd /usr/local/nexus-webapp-1.3.6/
给与权限
chmod -R a+x bin
./bin/jsw/linux-x86-32/nexus start

3、nexus设置
访问地址
http://localhost:8081/nexus
登陆名admin 密码 admin123

开启远程索引下载
点击View/Repositories菜单下面的Repositories,将这三个仓库
Apache Snapshots
Codehaus Snapshots
Maven Central的
Download Remote Indexes修改为true。
然后在这三个仓库上分别右键,选择Re-index,这样Nexus就会去下载远程的索引文件。

配置maven
使用和原来设置artifactory相似的方法
<profile>
<id>nexus_local</id>
<repositories>
<repository>
<id>nexus_local</id>
<name>local private nexus</name>
<url>http://localhost:8081/nexus/content/groups/public</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<repository>
<id>nexus_local</id>
<name>local private nexus</name>
<url>http://localhost:8081/nexus/content/groups/public-snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus_local</id>
<name>local private nexus</name>
<url>http://localhost:8081/nexus/content/groups/public</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</pluginRepository>
<pluginRepository>
<id>nexus_local</id>
<name>local private nexus</name>
<url>http://localhost:8081/nexus/content/groups/public-snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>

<activeProfiles>
<activeProfile>nexus_local</activeProfile>
</activeProfiles>

为nexus增加Artifact
在nexus中我选择将这些Artifact上传到默认安装就存在的仓库3rd Party中,右击仓库名,
选择Upload Artifact

为nexus增加新的proxy repository

方法很简单,
Repositories -> add -> proxy,填写后保存即可。但是要注意,nexus不会自动将新加入的repository添加到group中,而我们一般喜欢直接使用默认的"public repository" group, 比如前面我在maven的profile中就只设置了这一个URL: http://localhost:8081/nexus/content/groups/public。因此需要手工修改"public repository" group的设置,将刚才添加的proxy repository加到组中。
推荐的repository有:
1) jboss http://repository.jboss.com/maven2/
2) sun http://download.java.net/maven/2/
3)k-int http://developer.k-int.com/maven2/
加入这个纯粹是因为它有sun的jmxri/jmxtools这些Artifact,强烈鄙视sun,自己的官方repository居然没有。
4)sonatype http://repository.sonatype.org/content/groups/public/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值