Maven 私服nexus搭建-window环境
1 下载
从[官网] 下载最新版本的Nexus
1 https://www.sonatype.com/download-oss-sonatype
2 https://help.sonatype.com/repomanager2/download
(貌似要翻墙 请自备梯子)
2 安装
当前下的是nexus-3.18.0-01.zip
解压后 cmd进入bin目录
执行 nexus.exe /run 提示一下信息为启动成功
----------------------------------------------
Started Sonatype Nexus OSS 3.18.0-01
----------------------------------------------
3 登录 进入管理界面
1 http://localhost:8081/ 端口默认为 :8081
2 账号默认为admin , 密码 在登录时 会提示在指定的目录文件夹下
3 第一次登录后会提示修改密码
4 添加 Repositories
1 管理配置界面-Repository-create repository
2 选择maven2 hosted)
3 hosted 选择 Allow redeploy 表示该仓库接收我们上传构件
然后 Create repository
4 重新进入 点击Rebuild iindex 更新索引
5 更改 maven 配置文件 settings.xml (默认 C:\Users\work.m2)
<server>
<id>jerry-maven-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
6 配置pom.xml文件
<!-- 私服仓库配置 id需要跟settings.xml的id一致 -->
<repositories>
<repository>
<id>jerry-maven-releases</id>
<url>http://localhost:8081/repository/jerry-maven-releases/</url>
<releases>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
</repositories>
<!-- 发布私服配置 id需要跟settings.xml的id一致 -->
<distributionManagement>
<repository>
<id>jerry-maven-releases</id>
<url>http://localhost:8081/repository/jerry-maven-releases/</url>
</repository>
</distributionManagement>