我使用maven插件生成内部版本号时遇到麻烦, 我在pom文件中有插件配置,如
<plugin>
<groupId>ru.concerteza.buildnumber</groupId>
<artifactId>maven-jgit-buildnumber-plugin</artifactId>
<version>1.2.7</version>
<executions>
<execution>
<id>git-buildnumber</id>
<goals>
<goal>extract-buildnumber</goal>
</goals>
<phase>validate</phase>
<configuration>
<javaScriptBuildnumberCallback>
tag + "_" + branch + "_" +shortRevision + "_" + commitsCount
</javaScriptBuildnumberCallback>
</configuration>
</execution>
</executions>
</plugin>
所以,我的问题是我想打印带有内部版本号的时间戳,有谁能告诉我如何用内部版本号打印时间戳?
答案 0 :(得分:2)
根据您的maven版本,使用maven.build.timestamp属性或maven-timestamp-plugin。
<plugins>
<plugin>
<groupId>com.keyboardsamurais.maven</groupId>
<artifactId>maven-timestamp-plugin</artifactId>
<version>1.0</version>
<configuration>
<propertyName>timestamp</propertyName>
<timestampPattern>dd.MM.yyyy HH:mm</timestampPattern>
</configuration>
<executions>
<execution>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
</plugin>
...
<javaScriptBuildnumberCallback>
tag + "_" + branch + "_" +shortRevision + "_" + commitsCount + "_" + ${timestamp}
</javaScriptBuildnumberCallback>
答案 1 :(得分:0)
我向该插件添加了新属性,包括buildDate
。另外,您可以指定应使用哪个TimeZone,例如系统默认时区或某个特定时区(与始终以UTC返回的Maven时间戳相反)。请参见https://github.com/elab/jgit-buildnumber(该插件也已发布到Maven Central)。