[
https://issues.jenkins-ci.org/browse/JENKINS-9693?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=159852#comment-159852
]
allenservedio commented on JENKINS-9693:
----------------------------------------
I wound up creating this timestamp via the Codehaus Build Number plugin
(http://mojo.codehaus.org/buildnumber-maven-plugin/create-timestamp-mojo.html).
Here is the Maven config that I used (in my plugin dependency management):
{code:xml}
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>create-timestamp</goal>
</goals>
</execution>
</executions>
<configuration>
<timestampFormat>yyyyMMddHHmmssSSS</timestampFormat>
<timestampPropertyName>releaseTimestamp</timestampPropertyName>
</configuration>
</plugin>
{code}
Am I correct that the reason this was not fixed already is that the point in
the maven lifecycle where the statically formatted timestamp is created, the
pom file(s) have not been evaluated. As such, it does not have access to this
property (maven.build.timestamp.format) and so does not know that the user has
defined it? If that is true, is there something else that can be used in
Jenkin's Maven integration that can get access to this property and use it
correctly?
Thanks!
Allen
> maven.build.timestamp.format is not obeyed in maven builds
> ----------------------------------------------------------
>
> Key: JENKINS-9693
> URL: https://issues.jenkins-ci.org/browse/JENKINS-9693
> Project: Jenkins
> Issue Type: Bug
> Components: maven2
> Reporter: Dan C
> Priority: Minor
>
> Since Maven 2.1 it is possible to control the format of the
> {{maven.build.timestamp}} property [by setting the
> {{maven.build.timestamp.format}}
> property|http://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Special_Variables].
> This works correctly with mvn version 3.0.3:
> {code:xml|title=pom.xml}
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <groupId>invalid.example.test</groupId>
> <artifactId>test</artifactId>
> <version>1.0-SNAPSHOT</version>
> <packaging>jar</packaging>
> <properties>
>
> <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format>
> <build.timestamp>${maven.build.timestamp}</build.timestamp>
> </properties>
> <build>
> <resources>
> <resource>
> <directory>src/main/filtered-resources</directory>
> <filtering>true</filtering>
> </resource>
> </resources>
> </build>
> </project>
> {code}
> {code:title=src/main/filtered-resources/test.properties}
> Build-Timestamp: ${build.timestamp}
> {code}
> {code:title=target/classes/test.properties}
> Build-Timestamp: 2011-05-15T18:56:20+1000
> {code}
> but in Jenkins 1.411 the default timestamp format is used instead:
> {code:title=target/classes/test.properties}
> Build-Timestamp: 20110515-1857
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira