tags:

views:

52

answers:

2

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.

A: 

Try: <propertyfile file="..." comment="">

Edit: Which probably won't work :(. It looks like the culprit is actually Properties.store(OutputStream, String):

Next, a comment line is always written, consisting of an ASCII # character, the current date and time (as if produced by the toString method of Date for the current time), and a line separator as generated by the Writer.

kschneid
Umm. I checked the source and there does not appear to be a way to get around this. Both the LayoutPreservingProperties class (used by default) and the Properties class (used when useJDKProperties is set to true) have this in their store method.
javacavaj
+1  A: 

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="^#.*" replace="#" byline="true" />
</target>
JasonMArcher
excellent workaround!
javacavaj