SVN revision number and timestamp

2019-04-08 20:07发布

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条回答
时光不老,我们不散
2楼-- · 2019-04-08 20:43

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.

查看更多
登录 后发表回答