Skip to main content
Last updated July 04, 2011 06:49, by Aede
Feedicon  

Maven TStamp Plugin Wiki

Introduction

Need time and/or date properties in your Maven project? This project is all about a custom Maven plugin that is bases on Ant's task TStamp. It provides default properties and allows for all formats known in Java. A specific locale and/or time zone can be specified to get what you want. Also it is possible to specify an offset in a particular unit.

Release News

A stable release 1.0 has been promoted to Maven Central on 2 July 2011.

Example Configuration

<plugin>
  <groupId>nl.fizzit.maven.plugins</groupId>
  <artifactId>maven-tstamp-plugin</artifactId>
  <version>1.0</version>
    <executions>
      <execution>
        <goals>
          <goal>export</goal>
        </goals>
        <configuration>
          <formats>
            <format>
              <property>test.date</property>
              <pattern>yyyy MMMM dd hhmm</pattern>
              <locale>en,US</locale>
              <timezone>Asia/Tokyo</timezone>
              <offset>-1</offset>
              <unit>hour</unit>
            </format>
            <format>
              <property>test2.date</property>
              <pattern>yyyyMMdd</pattern>
              <offset>30</offset>
              <unit>day</unit>
            </format>
          </formats>
        </configuration>
      </execution>
    </executions>
</plugin>

Example Usage

# mvn nl.fizzit.maven.plugins:maven-tstamp-plugin:export
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven TStamp Plugin
[INFO]    task-segment: [nl.fizzit.maven.plugins:maven-tstamp-plugin:export]
[INFO] ------------------------------------------------------------------------
[INFO] [tstamp:export]
[INFO] Setting TStamp properties
[INFO] Property DSTAMP set to 20110623
[INFO] Property HSTAMP set to 1048
[INFO] Property TODAY set to juni 23 2011
[INFO] -- Exporting custom format
[INFO] Using timezone: Japan Standard Time
[INFO] Using locale: English (United States)
[INFO] Adjusting time offset 1 (unit day)
[INFO] Property test.date set to 2011 June 24 0548
[INFO] -- Exporting custom format
[INFO] Adjusting time offset 30 (unit day)
[INFO] Property test2.date set to 20110723
[INFO] TStamp properties set
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Thu Jun 23 10:48:35 CEST 2011
[INFO] Final Memory: 2M/508M
[INFO] ------------------------------------------------------------------------

Repository

Stable releases of this plugin are available from Maven Central's repository.

Snaphots releases can be obtained from java.net's repository:

https://maven.java.net/content/groups/public/

Sources

Sources are managed in subversion and can be accessed with the following url: http://java.net/projects/maventstampplugin/sources/svn/show

Miscellaneous

A similar plugin has already been developed but has not been made available through Maven Central. http://java.sogeti.nl/JavaBlog/2008/08/28/maven-tstamp-plugin/ This however lacks the offset feature.

 
 
Close
loading
Please Confirm
Close