SVN revision number and timestamp

核能气质少年 提交于 2019-12-09 18:30:04

问题


I'm trying to display the latest SVN revision number and timestamp on the title bar of a web application. My current code displays the revision number but not timestamp. Both are not coming together. I'm using the following code.

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>buildnumber-maven-plugin</artifactId>
  <version>1.2</version>
  <executions>

    <execution>
      <phase>validate</phase>
      <goals>
        <goal>create</goal>
      </goals>
      <configuration>
        <useLastCommittedRevision>true</useLastCommittedRevision>
      </configuration>
    </execution>

    <execution>
      <id>generate-timestamp</id>
      <phase>validate</phase>
      <goals>
        <goal>create</goal>
      </goals>
    </execution>

  </executions>
</plugin>

It displays the revision number only. From the jsp I'm accessing the value like this

${initParam['build']}

Then it shows the revision. What is the modification required to display revision and timestamp. And how can I access the timestamp value?


回答1:


I'm using like this now:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.2</version>
<executions>
    <execution>
        <phase>validate</phase>
        <goals>
            <goal>create</goal>
        </goals>
    </execution>
</executions>
<configuration>
    <format>{0} - {1,date,yyyy-MM-dd HH:mm:ss}</format>
    <items>
        <item>scmVersion</item>
        <item>timestamp</item>
    </items>
</configuration>

And access the value from jsp like this:

${initParam['build']}

This shows the SVN revision number first and then the timestamp.



来源:https://stackoverflow.com/questions/14374674/svn-revision-number-and-timestamp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!