首页 技术 正文
技术 2022年11月17日
0 收藏 470 点赞 4,947 浏览 3452 个字

1.拉取镜像

docker pull sonatype/nexus3 

2.启动容器

sudo docker run -d --name nexus3 --restart=always -p : -p : -p : -v /mnt/gv0/nexus-data:/nexus-data sonatype/nexus3

3.修改maven settings.xml 这里使用默认用户名 admin 密码 admin123

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>H:\localRepository</localRepository><pluginGroups></pluginGroups>
<proxies></proxies> <servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server> <server>
<id>maven-public</id>
<username>admin</username>
<password>admin123</password>
</server> <server>
<id>maven-releases</id>
<username>admin</username>
<password>admin123</password>
</server> <server>
<id>maven-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server> <server>
<id>3rd-part</id>
<username>admin</username>
<password>admin123</password>
</server> <server>
<id>maven-central</id>
<username>admin</username>
<password>admin123</password>
</server> </servers> <mirrors>
<mirror>
<id>maven-public</id>
<name>public</name>
<mirrorOf>central</mirrorOf>
<url>http://192.168.91.137:8081/repository/maven-public/</url>
</mirror> <mirror>
<id>maven-releases</id>
<name>releases</name>
<mirrorOf>central</mirrorOf>
<url>http://192.168.91.137:8081/repository/maven-releases/</url>
</mirror> <mirror>
<id>maven-snapshots</id>
<name>snapshots</name>
<mirrorOf>central</mirrorOf>
<url>http://192.168.91.137:8081/repository/maven-snapshots/</url>
</mirror> <mirror>
<id>3rd-part</id>
<name>3rd-part</name>
<mirrorOf>central</mirrorOf>
<url>http://192.168.91.137:8081/repository/3rd-part/</url>
</mirror> <mirror>
<id>maven-central</id>
<name>maven-central</name>
<mirrorOf>central</mirrorOf>
<url>http://192.168.91.137:8081/repository/maven-central/</url>
</mirror>
</mirrors><profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus</id>
<url>http://192.168.91.137:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<url>http://192.168.91.137:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles><activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles></settings>

4.如果项目需要发布到nexus,修改pom 添加以下 distributionManagement 内容

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <groupId>org.lzw</groupId>
<artifactId>idworker</artifactId>
<version>1.0-SNAPSHOT</version> <distributionManagement> <repository>
<id>maven-releases</id>
<name>maven-releases</name>
<url>http://192.168.91.137:8081/repository/maven-releases/</url>
</repository> <snapshotRepository>
<id>maven-snapshots</id>
<name>maven-snapshots</name>
<url>http://192.168.91.137:8081/repository/maven-snapshots/</url>
</snapshotRepository> </distributionManagement></project>

5.发布

docker 快速搭建Nexus3

登录进入  http://192.168.91.137:8081 页面查看 默认用户名 admin 密码 admin123

docker 快速搭建Nexus3

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,088
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,564
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,413
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,186
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,822
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,905