1

我无法使用 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>

所以,我的问题是我想打印带有内部版本号的时间戳,谁能告诉我如何打印带有内部版本号的时间戳?

4

2 回答 2

2

Depending on your maven version, either use the maven.build.timestamp property or the 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>
于 2014-05-14T13:06:43.210 回答
0

buildDate我向该插件添加了新属性,包括。此外,您可以指定应该使用哪个 TimeZone,例如系统默认时区或某个特定时区(与始终以 UTC 格式返回的 Maven 时间戳相反)。请参阅https://github.com/elab/jgit-buildnumber(插件也发布到 Maven Central)。

于 2019-03-10T18:35:28.910 回答