Dra-M Dra-M
首页
技术
冥思
哲学
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

莫小龙

保持理智,相信未来。
首页
技术
冥思
哲学
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • Java

  • Golang

  • 编程思想

  • 微服务

  • 中间件

  • Python

  • 运维

    • Linux

    • Bash

    • DevOps

      • 前言:搭建一套自有的围绕K8S的DevOps工具
      • 部署K8S -- kubeasz
      • 部署NFS服务器
      • 为K8S添加StorageClass
      • 学习用NodePort暴露K8S服务
      • 外部nginx代理到nodeport
      • 使用Docker安装LDAP
      • 使用K8S部署LDAP管理面板
      • 使用Docker部署第三方K8S面板Kuboard,并连接LDAP
      • 使用K8S部署GitLab,并连接LDAP
      • 使用K8S部署Jenkins,并连接LDAP
      • 使用K8S部署Nexus,并连接LDAP
      • Nexus Maven私服配置
      • Nexus Docker私服配置+K8S拉取私服镜像
      • Jenkins Pipeline 从 K8s Agent 启动构建
      • Jenkins Pipeline 拉取Git代码 获取提交信息
      • Jenkins Pipeline Maven打包
      • Jenkins Pipeline BuildDockerImage 推送到私服
      • Jenkins Pipeline 部署程序到K8S
      • Jenkins Pipeline 共享库
      • Loki日志收集+K8S
      • SkyWalking链路追踪+K8S、
      • SpringCloud+K8S联调说明
      • DevOps WebHook汇总 (Gitlab,Jenkins,K8S Event)
  • 技术
  • 运维
  • DevOps
莫小龙
2022-04-11

Nexus Maven私服配置

客户端会从maven-public拉取,如果只关联两个私有仓库releases和snapshots,拉取不到时客户端回去其他镜像拉取。

如果关联了阿里云,中心仓库等,在客户端拉取时会认为可以在私服拉取到,所以在私服做跳板拉取。

这里我的实现方式时让私服public只关联两个私有仓库,客户端配置时配置多个镜像,不走跳板,私服有的在私服拉,没有的去阿里云或中央仓库拉。

我的maven客户端配置:

<?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>./repository</localRepository> 
 <pluginGroups> 
   <pluginGroup>org.sonatype.plugins</pluginGroup> 
 </pluginGroups> 
 <servers> 
   <server> 
     <id>nexus</id> 
     <username>ldap用户名</username> 
     <password>ldap密码</password> 
   </server> 
   <server> 
     <id>releases</id> 
     <username>ldap用户名</username> 
     <password>ldap密码</password> 
   </server> 
   <server> 
     <id>snapshots</id> 
     <username>robot</username> 
     <password>ldap密码</password> 
   </server> 
 </servers> 
 <mirrors> 
   <mirror> 
     <id>central</id> 
     <mirrorOf>central</mirrorOf> 
     <name>central</name> 
     <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> 
     <blocked>false</blocked> 
   </mirror> 
   <mirror> 
     <id>alimaven</id> 
     <mirrorOf>aliyun</mirrorOf> 
     <name>阿里云</name> 
     <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> 
     <blocked>false</blocked> 
   </mirror> 
   <mirror> 
     <id>nexus</id> 
     <mirrorOf>nexus</mirrorOf> 
     <name>私服</name> 
     <url>http://nexus.dev.dra-m.com/repository/maven-public/</url> 
     <blocked>false</blocked> 
   </mirror> 
 </mirrors> 
 <profiles> 
   <profile> 
     <id>nexus</id> 
     <properties> 
       <altSnapshotDeploymentRepository>snapshots::default::http://nexus.dev.dra-m.com/repository/maven-snapshots/</altSnapshotDeploymentRepository> 
       <altReleaseDeploymentRepository>releases::default::http://nexus.dev.dra-m.com/repository/maven-releases/</altReleaseDeploymentRepository> 
     </properties> 
   </profile> 
       <profile> 
     <id>dev</id> 
     <repositories> 
       <repository> 
         <id>nexus</id> 
         <name>私服</name> 
         <url>http://nexus.dev.dra-m.com/repository/maven-public/</url> 
           <blocked>false</blocked> 
         <releases> 
           <enabled>true</enabled> 
         </releases> 
         <snapshots> 
           <updatePolicy>always</updatePolicy> 
           <enabled>true</enabled> 
         </snapshots> 
       </repository> 
        <repository> 
         <id>aliyun</id> 
         <name>阿里云</name> 
         <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> 
           <blocked>false</blocked> 
         <releases> 
           <enabled>true</enabled> 
         </releases> 
       </repository> 
     </repositories> 
     <pluginRepositories> 
       <pluginRepository> 
         <id>plugins</id> 
         <name>Plugin 阿里云</name> 
         <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> 
        <blocked>false</blocked> 
       </pluginRepository> 
       <pluginRepository> 
         <id>plugins</id> 
         <name>Plugin 私服</name> 
         <url>http://nexus.dev.dra-m.com/repository/maven-public/</url> 
        <blocked>false</blocked> 
       </pluginRepository> 
     </pluginRepositories> 
   </profile> 
 </profiles> 
 
 <activeProfiles> 
   <activeProfile>dev</activeProfile> 
 </activeProfiles> 
</settings>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

设置Blocked标签是因为新版Maven校验了HTTPS,如果不设置为False无法拉取

设置了snapshots每次都重新拉取

上传配置:

<distributionManagement>
    <repository>
        <id>releases</id>
        <name>Nexus Release Repository</name>
        <url>http://nexus.dev.dra-m.com/repository/maven-releases/</url>
    </repository>
    <snapshotRepository>
        <id>snapshots</id>
        <name>Nexus Snapshot Repository</name>
        <url>http://nexus.dev.dra-m.com/repository/maven-snapshots/</url>
    </snapshotRepository>
</distributionManagement>
1
2
3
4
5
6
7
8
9
10
11
12

#DevOps#K8S#运维#LDAP#Nexus#Maven
上次更新: 10/23/2024
使用K8S部署Nexus,并连接LDAP
Nexus Docker私服配置+K8S拉取私服镜像

← 使用K8S部署Nexus,并连接LDAP Nexus Docker私服配置+K8S拉取私服镜像→

最近更新
01
mosquito配置ws协议
10-23
02
Pip包的离线下载和安装
10-23
03
stable diffusion 相关收藏
02-24
更多文章>
Theme by Vdoing | Copyright © 2019-2024 Dra-M
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式