Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing Date Comment from Apache's Ant PropertyFile Task

Tags:

java

ant

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>

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

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.

like image 256
javacavaj Avatar asked Aug 10 '10 18:08

javacavaj


1 Answers

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>
like image 187
JasonMArcher Avatar answered Nov 09 '22 22:11

JasonMArcher