原创

nexus3 maven私服搭建

Nexus3 docker 安装
1.创建数据目录卷                    mkdir /home/nexus-data && chown -R 200 /home/nexus-data

2.启动nexusdocker容器          docker run -d -p 8081:8081 --name nexus   -u root   -e NEXUS_CONTEXT=nexus  -v /home/nexus-data:/nexus-data sonatype/nexus3

3.在maven的setting.xml的servers标签下新增以下标签 ,将jar包发送到私服的凭证

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


4.在项目中新增以下配置,

<!-- 设定插件仓库 -->
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>nexus</id>
<!--
<url>http://maven.aliyun.com/nexus/content/groups/public/</url> -->
<url>http://192.168.1.110:7080/nexus/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>




正文到此结束
Loading...