1.拉取nexus3的镜像docker pull sonatype/nexus32.将容器内部/var/nexus-data挂载到主机/root/nexus-data目录。docker run -d -p 8081:8081 --name nexus -v /root/nexus-data:/var/nexus-data --restart=always sonatype/nexus3默认账号: 账号:admin/admin123 密码地址:/nexus-data/
如何发布项目发布到nexus
1.在项目的根pom.xml文件中添加如下的配置内容 <!--发布配置--> <distributionManagement> <repository> <!--id跟nexus中仓库的id保持一致--> <id></id> <!--将nexus中的repository path复制下来即可--> <url></url> </repository> </distributionManagement>2.maven的setting.xml文件中的配置我们需要在setting.xml中添加不同仓库的用户验证 <server> <id>releases</id> <username>admin</username> <password>admin123</password> </server> <server> <id>snapshots</id> <username>admin</username> <password>admin123</password> </server>3.将项目打包发布 mvn deploy注意:发布的仓库是SNAPSHOTS的话,那么你发布的jar包就不能是RELEASE后缀的项目