版本中加上时间戳
<properties>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
</properties>
<build>
<finalName> ${project.artifactId}-${maven.build.timestamp}</finalName>
</build>
时间戳的时区问题
https://juejin.cn/post/7011877028848910344
手里的任务就是要将Maven打的包设置成xxx-2021209252204.jar,因为是springboot项目,网上的例子其实有很多。
开始时使用了maven自带的时间插件,直接在properties标签中加入时间格式的设置,如下:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>timestamp-property</id>
<goals>
<goal>timestamp-property</goal>
</goals>
<configuration>
<name>build.time</name>
<pattern>yyyyMMddHHmm</pattern>
<locale>zh_CN</locale>
<timeZone>GMT+8</timeZone>
</configuration>
</execution>
</executions>
</plugin>
<!-- 要将maven.build.timestamp替换成build.time,因为要使用buildnubmer-maven-plugin组件中声明的时间串。-->
<finalName>${project.artifactId}-${build.time}</finalName>