Adam Rofer commented on Bug JENKINS-9693

All of the above workarounds provide different timestamps in each submodule in a multi-module build. The only thing I managed to get working was the following code:

<plugin>
    <groupId>com.github.goldin</groupId>
    <artifactId>timestamp-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>set-specific-timestamp</id>
            <goals>
                <goal>timestamp</goal>
            </goals>
            <phase>initialize</phase>
            <configuration>
                <time>{{ 
                         def newdate = null;
                         try {
                             newdate = Date.parse( "${maven.build.timestamp.format}", "${maven.build.timestamp}");
                         } catch (Exception e) {
                             newdate = Date.parse( "yyyyMMdd-HHmm", "${maven.build.timestamp}");
                             println "THANKS JENKINS, FOR JENKINS-9693";
                         }
                         newdate 
                 }}</time>
                <timestamp>
                    <property>actual-timestamp</property>
                    <pattern>${maven.build.timestamp.format}</pattern>
                </timestamp>
            </configuration>
        </execution>
    </executions>
</plugin>

...and then use actual-timestamp as your timestamp property.
This assumes you already have maven.build.timestamp.format set as a property.

Note that you can put whatever pattern you want in the <pattern> field, in this case it just formats it the way you originally wanted it

Also note that this will only reach minute resolution on Jenkins builds since that's what Jenkins munges it to.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to