来自Apache的Ant任务PropertyFile删除日期评论 [英] Removing Date Comment from Apache's Ant PropertyFile Task

查看:113
本文介绍了来自Apache的Ant任务PropertyFile删除日期评论的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用我的构建脚本如下所示的propertyfile任务:

I'm using the propertyfile task shown below in my build script:

<target name="build-brand" depends="-init" description="Adds version information to branding files.">
    <propertyfile file="${basedir}/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties">
        <entry key="currentVersion" value="${app.windowtitle} ${app.version}" />
    </propertyfile>
</target>

任务按预期方式工作,除了每个我生成项目时,Bundle.properties文件的日期注释行与当前时间戳更新。出现这种情况即使app.version变量不发生改变,导致一个非必要提交到版本控制由以下差异,但目的只:

The task works as expected, except that each time I build the project, the date comment line of the Bundle.properties file is updated with the current time stamp. This occurs even if the app.version variable does not change and results in an un-necessary commit to version control consisting solely of the following diff:

--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -1,4 +1,4 @@
-#Thu, 22 Jul 2010 15:05:24 -0400
+#Tue, 10 Aug 2010 13:38:27 -0400

我如何prevent添加或删除此日期评论作者的.properties文件?我认为propertyfile嵌套entry元素删除操作,但需要一个键值。

How can I prevent addition of or remove this date comment from the .properties file? I considered a delete operation in propertyfile nested entry element, but a key value is required.

推荐答案

这是不是一个很好的解决方案,但如何删除注释一起?

This isn't a great solution, but how about removing the comment all together?

<target name="build-brand" depends="-init" description="Adds version information to branding files.">
    <propertyfile file="${basedir}/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties">
        <entry key="currentVersion" value="${app.windowtitle} ${app.version}" />
    </propertyfile>
    <replaceregexp file="${basedir}/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties" match="^#.*\n" replace=""/>
</target>

这篇关于来自Apache的Ant任务PropertyFile删除日期评论的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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