Maven仓库Nexus的安装配置

时间:2023-09-27 14:41:32

1.下载nexus,最新版本是nexus-2.8.0-05   参考文章

下载nexus-latest-bundle.zip文件后,并解压到  D:\nexus下

配置nexus的环境变量:先配置NEXUS_HOME的环境变量,新建一个系统变量:NEXUS_HOME , 路径是:D:\nexus\nexus-2.8.0-05

2.再配置path环境变量,在path值的末尾添加"%NEXUS_HOME%\bin\jsw\windows-x86-64"

3.配置完成后cmd命令执行 D:\nexus\nexus-2.8.0-05\bin\jsw\windows-x86-64安装install-nexus.bat服务,服务安装成功后执行start-nexus.bat启动服务,Nexus启动成功了,然后打开浏览器,访问http://127.0.0.1:8081/nexus

4.配置Maven使用Nexus:

•配置maven中心库地址在setting.xml的<profiles></profiles>之间增加如下配置

<profile>
<id>LocalProfile<id>
<repositories>
<id>local-nexus</id>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repositories>
</profile>

5.url应修改为对应maven服务器的地址,然后激活该profile

<activeProfiles>
<activeProfile>LocalProfile</activeProfile>
</activeProfiles>

6.配置自动更新新版本到maven的用户名密码在setting.xml的servers节点下增加如下配置

<server>
<id>sunrise-releases<id>
<username>admin</username>
<password>admin123</password>
</server> <server>
<id>sunrise-snapshots<id>
<username>admin</username>
<password>admin123</password>
</server>