Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to timestamp an output artifact in Maven?

I am trying to find out if Maven has some built-in plug-in that can be used to time-stamp artifacts. I created an assembly file and am using the maven-assembly plugin to create a final distribution (jars,docs,scripts, etc). I want to name this distribution file as domain_year_month_day.zip. How can I append the day portion of a timestamp to the end of the final zip file that is being produced. Thanks.

like image 632
John Avatar asked Nov 02 '10 19:11

John


1 Answers

You don't need the maven-timestamp-plugin with newer versions of maven. Since 2.1'ish, Maven has provide the special property maven.build.timestamp.

You set the format in the pom properties with something like this:

<maven.build.timestamp.format>yyyy-MM-dd'T'HH.mm.ss</maven.build.timestamp.format>

And then use ${maven.build.timestamp} wherever you need a timestamp property. See http://maven.apache.org/guides/introduction/introduction-to-the-pom.html for details.

like image 106
lreeder Avatar answered Sep 21 '22 20:09

lreeder