我在构建脚本中使用下面显示的属性文件任务:
<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>
Run Code Online (Sandbox Code Playgroud)
该任务按预期工作,除了每次构建项目时,Bundle.properties文件的日期注释行都使用当前时间戳更新.即使app.version变量没有改变也会发生这种情况,并导致对仅包含以下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
Run Code Online (Sandbox Code Playgroud)
如何防止在.properties文件中添加或删除此日期注释?我在propertyfile嵌套的entry元素中考虑了删除操作,但是需要一个键值.
这不是一个很好的解决方案,但如何一起删除评论呢?
<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>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2131 次 |
| 最近记录: |