Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding the current date with Maven2 filtering

I have a Maven2 project, and I need to add, in a properties file, the current version and the current date.

For the current version, I've used ${project.version}, which works correctly.

My question is how can I set the current date (i.e. the date when the build is done by Maven2) in my properties file:

client.version=Version ${project.version} client.build=??? 

(in addition, if I can specify the format for the date, it will be really great)

like image 778
Romain Linsolas Avatar asked Apr 29 '09 14:04

Romain Linsolas


1 Answers

Feature does not work with maven 2.2.1 resource filtering.

See: https://issues.apache.org/jira/browse/MRESOURCES-99

But you could create a custom property in the parent pom:

<properties>     <maven.build.timestamp.format>yyMMdd_HHmm</maven.build.timestamp.format>     <buildNumber>${maven.build.timestamp}</buildNumber> </properties> 

Where buildNumber is the new property that can be filtered into the resources.

like image 127
2 revs, 2 users 96% Avatar answered Sep 16 '22 21:09

2 revs, 2 users 96%