介绍

搭建Nexus私服的主要目的是为了解决工作上组件之间的jar包依赖管理。
特别是基础架构部门的jar包要共享出来,就需要把jar包deploy发布到nexus私服上。

Compose准备

docker-compose.yml

  1. version: "3.5"
  2. services:
  3. nexus-server:
  4. image: sonatype/nexus3
  5. container_name: nexus3
  6. ports:
  7. - 8081:8081
  8. volumes:
  9. - /etc/timezone:/etc/timezone:ro
  10. - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro
  11. - /opt/nexus/nexus-data:/nexus-data
  12. restart: always

启动容器

  1. #挂载文件授权
  2. mkdir -p /opt/nexus/nexus-data && chown -R 200:200 /opt/nexus/nexus-data
  3. #时区设置
  4. echo "Asia/Shanghai" > /etc/timezone
  5. #在compose文件所在目录启动
  6. docker-compose up -d

初次登录修改密码

#查看默认密码,默认用户名admin
cat /opt/nexus/nexus-data/admin.password

包管理预览

image.png

上传jar包

image.png

项目pom配置

image.png
image.png
image.png