docker-compose Nexus3安装

2020/10/2 nexusdocker-compose

构建环境:docker、docker-compose

# 配置文件

vim /docker/docker-compose.yml

version: "3.9"
services:
  nexus:
    image: sonatype/nexus3:3.17.0
    container_name: nexus
    restart: always
    ports:
      - "8081:8081" 
    volumes:
      - /docker/nexus/nexus-data:/nexus-data
      - /etc/localtime:/etc/localtime
    environment:
      - TZ=Asia/Shanghai
    privileged: true
    deploy:
      resources:
        limits:
          memory: 3024M

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

chmod 777 /docker/nexus/nexus-data

# 运行

运行:docker-compose up -d
1

访问: http://ip:8081
查看密码:nexus-data/admin.password
登录网页,修改密码 admin/123456

# 创建私有库

Repositories -> add "maven-qwrt" type:hosted format:maven2

# 创建仓库,指向阿里云

Repositories -> add "maven-aliyun" type:proxy format:maven2 proxy remote storage:http://maven.aliyun.com/nexus/content/groups/public

将阿里云库加入到maven-public库中 group member repositories 从available -> members maven-aliyun maven-qwrt (私有库)

# 创建角色和用户

创建角色"研发",分配权限
创建用户:liuxiangfei
密码:123456
分配上面的角色

# 配置maven

<server>
      <id>maven-qwrt</id>
      <username>liuxiangfei</username>
      <password>123456</password>
</server>

<mirror>
	<id>maven-public</id>
	<mirrorOf>*</mirrorOf>
	<name>maven-public</name>
	<url>http://120.77.204.210:8081/repository/maven-public/</url>
</mirror> 

1
2
3
4
5
6
7
8
9
10
11
12
13

# 上传私有jar包

mvn deploy:deploy-file "-DgroupId=com.qwrt.base" "-DartifactId=springboot-mqtt" "-Dversion=2.0.3" "-Dpackaging=jar" "-Dfile=D:\gitlab\qwrt-springboot\springboot-mqtt\target\springboot-mqtt-2.0.3.jar" "-Durl=http://www.tsuantone.top:8081/repository/maven-qwrt/" "-DrepositoryId=maven-qwrt"
1

第二次提交需要删除服务器上的包

Last Updated: 2023/12/4 12:06:46