下载nexuse
下载地址:https://www.sonatype.com/download-oss-sonatype
选择需要的版本下载
安装
1. 先安装jdk1.8版本
2. 注册windows服务,dos进入:解压路径下\nexus-3.16.0-01\bin,运行命令:nexus /install Nexus3
3. 启动服务:运行命令 nexus、start Nexus3
也可以在服务管理器中启动
4. 浏览器中访问 http://localhost:8081
使用
1. 在maven中添加私服配置
找到maven的setting.xml配置文件,添加配置 :mirrors镜像的位置, sercers私服用户名密码。
<mirrors>
<mirror>
<id>nexus</id>
<url>http://localhost:8081/repository/maven-public/</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<servers>
<server>
<id>release_user</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshot_user</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
2. 项目pom.xml中添加配置
<distributionManagement>
<repository>
<id>release_user</id>
<name>Release Deploy</name>
<url>http://localhost:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>snapshot_user</id>
<name>Snapshot Deploy</name>
<url>http://localhost:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
3.运行 mvn deploy后,进入私服查看上传的jar包