(五)Nexus 私服

[b]1.下载nexus,配置环境变量[/b]
[url]http://www.sonatype.org/nexus/go[/url]

[b]2.安装服务
cmd:
nexus install【如果提示无权限,使用超级管理员账户安装runas /user:administrator cmd 】
nexus start 启动服务【如果提示无权限,可以从管理-服务处开启】
[/b]
注意:
如果安装失败,则修改nexus-latest-bundle\nexus-2.5.1-01\bin\jsw\conf下的wrapper.conf文件指定java安装目录:wrapper.java.command=C:\Program Files (x86)\Java\jdk1.6.0_18

[b]3.访问服务[/b]
服务启动成功后,访问:http://localhost:8081/nexus/
点击右上角log in进行登陆
username:admin
password:admin123
到此,仓库安装完成!

[b]4.仓库的type[/b]

type: hosted(内部项目发布的仓库)
Releases 内部模板release版本的发布
SnapShots 发布内部的snapshot版本到此仓库
3rd party 第三方仓库,如数据库驱动jar包

type:proxy (从远程中央仓库获取数据的仓库)
Apache Snapshots
Central
Codehaus Snapshots

type:group (将多个仓库划分到一个组,pom中通过引入这个组完成配置)
Public Repository 该公共仓库组中默认包含了Releases,SnapShots,3rd party,Central 4个仓库,可以通过Configuration增加或减少仓库
【该组的仓库地址:http://192.168.199.1:8081/nexus/content/groups/public/】
可以在POM.xml中配置central为这个url,则中央仓库就是这个group组了。

[b]5.设置镜像-私有工厂[/b]
在本地仓库的settings.xml中配置镜像,配置后不论POM中配置的repository指向那个地址,都将访问私有工厂

<mirror>
<id>central</id>
<mirrorOf>*</mirrorOf>
<name>nexus的type=group的仓库:public repository.</name>
<url>http://192.168.199.1:8081/nexus/content/groups/public/</url>
</mirror>


[b]
6.私服的配置(更新索引)
[/b]
更新私服的中央仓库的索引
选中central仓库--->Configuration--->Download Remote Indexes:true
展开Administration--->Scheduled Tasks 可查看当前执行的任务
索引更新完毕后,点击central仓库--->browse indexs--->refresh查看仓库索引

[b]
7.配置用户的settings.xml,让该用户创建的所有项目都使用私服
[/b]
修改用户的settings.xml,添加repository。
目的:
对该用户所有maven项目都生效(这样每个项目中就不用再配置repository了)。这个repository只是作为一个配置,让maven项目有repository这个属性,不论配置到哪个仓库,都会映射到镜像(私服)中!
默认maven中存在一个repository的配置,在maven的buildjar包中,但是其对SNAPSHOT是关闭的。

<profile>
<id>central-repos</id>
<repositories>
<repository>
<id>central</id>
<name>Repository for central</name>
<url>http://privateServer</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>


激活profile的配置

<activeProfiles>
<activeProfile>central-repos</activeProfile>
</activeProfiles>


[color=darkred][size=x-large]如果nexus start启动失败,则检查8081端口是否被其它应用程序占用了!!![/size][/color]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值