如何添加时间戳信息Maven工件? [英] How do I add time-stamp information to Maven artifacts?

查看:401
本文介绍了如何添加时间戳信息Maven工件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我升级的大集结系统来使用,而不是蚂蚁Maven2的,我们有两个相关的要求,那我卡上:

I am upgrading a large build-system to use Maven2 instead of Ant, and we have two related requirements that I'm stuck on:


  1. 我们需要生成一个时间标记神器,所以在包的一部分
    相(或地方),而不是建立

  1. We need to generate a time-stamped artifact, so a part of the package phase (or wherever), instead of building

project-1.0-SNAPSHOT.jar

我们
应建立

project-1.0-20090803125803.jar

(其中
20090803125803 只是一个 YYYYMMDDHHMMSS 当罐子的时间戳
建)。

(where the 20090803125803 is just a YYYYMMDDHHMMSS time-stamp of when the jar is built).

的唯一真正的要求是,时间标记是的一部分
生成的文件的文件名。

The only real requirement is that the time-stamp be a part of the generated file's filename.

同样的时间戳已被列入一个的 version.properties 的文件中
生成罐内。

The same time-stamp has to be included within a version.properties file inside the generated jar.

此信息包含在生成的 pom.properties 的时候你跑,
例如, MVN包,但被注释掉:

This information is included in the generated pom.properties when you run, e.g., mvn package but is commented out:

#Generated by Maven
#Mon Aug 03 12:57:17 PDT 2009

这是从哪里开始将是有益的任何想法!谢谢!

Any ideas on where to start would be helpful! Thanks!

推荐答案

看一看行家-timestamp-插件 buildnumber - Maven的插件

如果你使用Maven的时间戳的插件,你可以使用这样的操作造成工件名称。

If you use maven-timestamp-plugin, you can use something like this to manipulate resulting artifact name.

<build>
   <finalName>${project.artifactId}-${project.version}-${timestamp}</finalName>
</build>

和这个配置buildnumber - Maven的插件应该创建一个包含时间戳值$ {}时间戳财产。似乎没有要创建方式的 version.properties 的直接使用这个插件文件。

And this configuration for buildnumber-maven-plugin should create a ${timestamp} property which contains the timestamp value. There doesn't seem to be a way to create the version.properties file directly with this plugin.

<configuration>
   <format>{0,date,yyyyMMddHHmmss}</format>
   <items>
      <item>timestamp</item>
   </items>

</configuration>

<一个href=\"http://apollo.ucalgary.ca/tlcprojectswiki/index.php/Public/Project_Versioning_-_Best_Practices#Build_Versioning\">These
3 也值得一试网站

这篇关于如何添加时间戳信息Maven工件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆