maven命令
wang 2021-07-21 maven
# maven私服配置
# maven配置模版
下列url的配置是样例,需要替换成自己的maven私服的地址
下列server的配置是样例,需要替换成自己的账号和密码
注意:如果maven项目有父子级工程,一定要用父级工程的deploy命令上传到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>
</pluginGroups>
<!-- 代理 -->
<proxies>
</proxies>
<!-- 私服账号 -->
<servers>
<server>
<id>mongoso-releases</id>
<username>wangzhong</username>
<password>123456</password>
</server>
<server>
<id>mongoso-snapshots</id>
<username>wangzhong</username>
<password>123456</password>
</server>
<server>
<id>mongoso-id</id>
<username>wangzhong</username>
<password>123456</password>
</server>
</servers>
<!-- 镜像地址 -->
<mirrors>
<mirror>
<!-- 阿里云国内镜像地址 -->
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<!-- maven私服 -->
<mirror>
<id>mongoso-id</id>
<mirrorOf>*,!alimaven</mirrorOf>
<url>http://{localhost:8081}/repository/maven-public/</url>
</mirror>
</mirrors>
<!-- 属性 -->
<profiles>
<profile>
<id>custom-repos</id>
<repositories>
<!-- 私有 Maven 仓库 -->
<repository>
<id>mongoso-releases</id>
<url>http://{localhost:8081}/repository/maven-public/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<!-- 阿里 公共仓库 -->
<repository>
<id>alimaven</id>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
</profile>
</profiles>
<!-- 激活配置文件 -->
<activeProfiles>
<activeProfile>custom-repos</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
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
# idea的pom配置
<project>
<!-- 上传到maven私服,-->
<distributionManagement>
<!-- 正式库-->
<repository>
<!-- 当前id一定要和maven配置文件server的id一致-->
<id>mongoso-releases</id>
<url>http://{localhost:8081}/repository/maven-releases/</url>
</repository>
<!-- 快照库-->
<snapshotRepository>
<!-- 当前id一定要和maven配置文件server的id一致-->
<id>mongoso-snapshots</id>
<url>http://{localhost:8081}/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<!-- 配置这个,表示该项目不上传到maven私服,按需配置-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
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
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