# maven打包在MANIFEST.MF增加SVN版本号
maven打包采用svn版本号做版本管理 (opens new window)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<scm>
<connection>scm:svn:http://code.taobao.org/svn/demo_</connection>
<developerConnection>scm:svn:http://code.taobao.org/svn/demo_</developerConnection>
<tag>HEAD</tag>
<url>http://code.taobao.org/svn/demo_</url>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>true</doUpdate>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<alikoubeiserver-svn-version>${buildNumber}</alikoubeiserver-svn-version>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<alikoubeiserver-svn-version>${buildNumber}</alikoubeiserver-svn-version>
</manifestEntries>
</archive>
</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
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
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
alikoubeiserver-svn-version: 7
Maven插件之buildnumber-maven-plugin (opens new window)
<modelVersion>4.0.0</modelVersion>
<artifactId>tva-wechat</artifactId>
<packaging>jar</packaging>
<scm>
<connection>scm:svn:http://10.0.2.28/repos/system/工程实施项目/浙江移动智能来电助手项目/2工程/code/tva-parent/tva-wechat</connection>
<developerConnection>scm:svn:http://10.0.2.28/repos/system/工程实施项目/浙江移动智能来电助手项目/2工程/code/tva-parent/tva-wechat</developerConnection>
<tag>HEAD</tag>
<url>http://10.0.2.28/repos/system/工程实施项目/浙江移动智能来电助手项目/2工程/code/tva-parent/tva-wechat</url>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<!--
若设置为true,会检查文件是否修改,若有修改,则构建失败;
Note that this used to be inverted (skipCheck), but needed to be
changed to allow releases to work. This corresponds to 'svn status'.
默认值: false. -->
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<!--若设置为true,版本号会更新为最新;否则会保持为本地值;
Note that this used to be inverted (skipUpdate),
but needed to be changed to allow releases to work.
This corresponds to 'svn update'.
默认值: false. -->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<alikoubeiserver-svn-version>${buildNumber}</alikoubeiserver-svn-version>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
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
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
← SpringBoot接口 鉴权 →