-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsettings.xml
More file actions
60 lines (54 loc) · 2.33 KB
/
settings.xml
File metadata and controls
60 lines (54 loc) · 2.33 KB
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
<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">
<!-- 配置本地缓存的路径一般不用设置, 默认是${user.home}/.m2/repository, 比如我想挂载一个磁盘单独放置这些仓库文件, 可以设置 -->
<localRepository>/data/apache-maven-3.5.2/data</localRepository>
<!-- 这里用于配置一些敏感信息, 比如密码等. 当mvn去连接mirror/repository下载依赖的时候会用到这些密码, 根据id来匹配对应的密码 -->
<servers>
<server>
<id>nexus</id>
<username>username</username>
<password>123456</password>
</server>
</servers>
<mirrors>
<!-- mirror相对于maven相当于hosts相对于Linux服务器, 能够拦截maven的公有仓库的请求 -->
<mirror>
<id>nexus</id>
<!-- 这里的*代表拦截所有仓库的的请求, 仓库是有ID的, 比如中央仓库是central -->
<mirrorOf>*</mirrorOf>
<name>自建maven仓库</name>
<!-- URL一般是公司自己搭建的私有仓库 -->
<url>http://maven.abc.com/repository/maven-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<!-- 下面的配置其实没有起作用, 所有对公有仓库的请求都会被mirror拦截 -->
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<!-- maven其实有一套插件系统, 很多动作都是插件来完成的.下面是差价的仓库配置, 同上. -->
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!-- 激活上面的配置 -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>