下载
https://www.sonatype.com/download-oss-sonatype
安装为服务
https://help.sonatype.com/repomanager3/installation/run-as-a-service
windows
nexus.exe /install
nexus.exe /start
nexus.exe /stop
nexus.exe /uninstall
不输入<optional-service-name>
,默认是nexus
需要以==管理员方式==打开cmd
cd nexus目录\bin
nexus.exe /install nexus
日志:Installed service ‘nexus’.
nexus.exe /start nexus
访问 http://127.0.0.1:8081
用户名/密码:admin/admin123
坑
ping不同127.0.0.1
应该是最近虚拟机网卡设置的过多的问题,导致出了一些问题
启动cmd
netsh winsock reset
重启电脑,解决
配置maven
添加对应仓库用户名密码
conf/setting.xml
<servers>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>nexus-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
maven工程
只修该本工程
pom.xml
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>http://127.0.0.1:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://127.0.0.1:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
修改本机
conf/setting.xml
发布到仓库
mvn deploy
releases/snapshot版本区分根据版本号后缀是否有-SNAPSHOT
来区别发布到releases还是发布到快照目录下