针对jar、war包,采用maven进行打包时,采用svn版本号进行版本管理,提供程序获取查看写入的版本号
<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.0modelVersion>
<groupId>com.examplegroupId>
<artifactId>demoartifactId>
<version>0.0.1-SNAPSHOTversion>
<packaging>warpackaging>
<name>demoname>
<description>Demo project for Spring Bootdescription>
<parent>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-parentartifactId>
<version>1.4.3.RELEASEversion>
<relativePath/>
parent>
<properties>
<project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8project.reporting.outputEncoding>
<java.version>1.8java.version>
properties>
<dependencies>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-webartifactId>
dependency>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-testartifactId>
<scope>testscope>
dependency>
dependencies>
<scm>
<connection>scm:svn:http://code.taobao.org/svn/demo_connection>
<developerConnection>scm:svn:http://code.taobao.org/svn/demo_developerConnection>
<tag>HEADtag>
<url>http://code.taobao.org/svn/demo_url>
scm>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojogroupId>
<artifactId>buildnumber-maven-pluginartifactId>
<version>1.4version>
<executions>
<execution>
<phase>validatephase>
<goals>
<goal>creategoal>
goals>
execution>
executions>
<configuration>
<doCheck>falsedoCheck>
<doUpdate>truedoUpdate>
configuration>
plugin>
<plugin>
<groupId>org.apache.maven.pluginsgroupId>
<artifactId>maven-jar-pluginartifactId>
<configuration>
<archive>
<manifestEntries>
<alikoubeiserver-svn-version>${buildNumber}alikoubeiserver-svn-version>
manifestEntries>
archive>
configuration>
plugin>
<plugin>
<groupId>org.apache.maven.pluginsgroupId>
<artifactId>maven-war-pluginartifactId>
<version>3.0.0version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>trueaddDefaultImplementationEntries>
manifest>
<manifestEntries>
<alikoubeiserver-svn-version>${buildNumber}alikoubeiserver-svn-version>
manifestEntries>
archive>
configuration>
plugin>
plugins>
build>
project>
Manifest-Version: 1.0
Implementation-Title: demo
Implementation-Version: 0.0.1-SNAPSHOT
Built-By: User
Implementation-Vendor-Id: com.example
alikoubeiserver-svn-version: 7
Created-By: Apache Maven 3.3.9
Build-Jdk: 1.8.0_91
Implementation-URL: http://projects.spring.io/spring-boot/demo/
Implementation-Vendor: Pivotal Software, Inc.
repository = ${prefix.repository}
path = ${prefix.path}
revision = ${prefix.revision}
mixedRevisions = ${prefix.mixedRevisions}
committedRevision = ${prefix.committedRevision}
committedDate = ${prefix.committedDate}
status = ${prefix.status}
specialStatus = ${prefix.specialStatus}
prefix对应pom.xml中的prefix可以修改
<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.0modelVersion>
<groupId>com.examplegroupId>
<artifactId>demoartifactId>
<version>0.0.1-SNAPSHOTversion>
<packaging>warpackaging>
<name>demoname>
<description>Demo project for Spring Bootdescription>
<parent>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-parentartifactId>
<version>1.4.3.RELEASEversion>
<relativePath/>
parent>
<properties>
<project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8project.reporting.outputEncoding>
<java.version>1.8java.version>
properties>
<dependencies>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-webartifactId>
dependency>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-testartifactId>
<scope>testscope>
dependency>
dependencies>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/resourcesdirectory>
<filtering>truefiltering>
resource>
resources>
<plugins>
<plugin>
<groupId>com.google.code.maven-svn-revision-number-plugingroupId>
<artifactId>maven-svn-revision-number-pluginartifactId>
<version>1.7version>
<configuration>
<verbose>trueverbose>
<entries>
<entry>
<prefix>prefixprefix>
<depth>emptydepth>
entry>
entries>
configuration>
<executions>
<execution>
<phase>validatephase>
<goals>
<goal>revisiongoal>
goals>
execution>
executions>
<dependencies>
<dependency>
<groupId>org.tmatesoft.svnkitgroupId>
<artifactId>svnkitartifactId>
<version>1.8.5version>
dependency>
dependencies>
plugin>
<plugin>
<groupId>org.apache.maven.pluginsgroupId>
<artifactId>maven-war-pluginartifactId>
<version>3.0.0version>
<configuration>
<webResources>
<resource>
<directory>src/main/resourcesdirectory>
<filtering>truefiltering>
<targetPath>WEB-INF/classestargetPath>
resource>
webResources>
configuration>
plugin>
plugins>
build>
project>
repository =
path =
revision = 7
mixedRevisions = false
committedRevision = 7
committedDate = 2017-01-13 00:06:47 +0800 (Fri, 13 Jan 2017)
status =
specialStatus =