Nexus学习笔记
maven 私服搭建
maven 下载地址:https://maven.apache.org/download.cgi
nexus 下载地址:https://www.sonatype.com/products/sonatype-nexus-oss-download
更换 maven 下载源为阿里源,调整 conf 下的 settings.xml
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
1
2
3
4
5
6
2
3
4
5
6
安装 nexus 私服,需要 jdk 环境
搭建私服后,配置 maven 在 nexus 下载,当 nexus 没用依赖文件时,去代理的阿里库中下载
nexus 默认用户名/密码:admin/admin123
修改 nexus 代理


获取本地仓库链接


http://10.0.0.21:8081/repository/maven-public/
修改 maven 的 settings.xml
<!--添加 <mirrors> 本地仓库,在之后下载包时通过 nexus 进行下载配置-->
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://10.0.0.21:8081/repository/maven-public/</url>
</mirror>
</mirrors>
<!--添加 <server> 认证信息,用于定义访问 Maven 仓库时的认证信息-->
<server>
<id>my-nexus-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>my-nexus-snapshot</id>
<username>admin</username>
<password>admin123</password>
</server>
<!--添加 <profile> 配置,用于定义一个 Maven 构建的配置文件,包含了仓库和插件仓库的设置-->
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://10.0.0.21:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://10.0.0.21:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<!--激活仓库-->
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
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
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
再次构建 java 项目,观察包的下载源
