SpringBoot Maven打包包含时间戳和svn版本号

1.修改pom.xml,在

<build><plugins></plugins></build>

里面添加

<!-- SVN版本号 -->
            <plugin>
                <groupId>com.google.code.maven-svn-revision-number-plugin</groupId>
                <artifactId>maven-svn-revision-number-plugin</artifactId>
                <version>1.7</version>
                <configuration>
                    <verbose>true</verbose>
                    <entries>
                        <entry>
                            <prefix>svn</prefix>
                        </entry>
                    </entries>
                </configuration>
                <executions>
                    <execution>
                        <id>revision</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.tmatesoft.svnkit</groupId>
                        <artifactId>svnkit</artifactId>
                        <version>1.8.5</version>
                    </dependency>
                </dependencies>
            </plugin>
            <!--打包时间-->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.10</version>
                <executions>
                    <execution>
                        <id>timestamp-property</id>
                        <goals>
                            <goal>timestamp-property</goal>
                        </goals>
                        <configuration>
                            <name>build.time</name>
                            <pattern>yyyyMMddHHmmss</pattern>
                            <locale>zh_CN</locale>
                            <timeZone>Asia/Shanghai</timeZone>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

2.打包项目名,在

<build></build>

里面添加

<finalName>${project.artifactId}-${project.version}.${svn.revision}-${build.time}</finalName>
上一篇:[RHEL5系统管理攻略]--第2章 磁盘与文件系统管理


下一篇:Mysql-性能调优