Removing Date Comment from Apache's Ant PropertyFile Task

后端 未结 3 1292
南笙
南笙 2021-01-17 20:05

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



        
相关标签:
3条回答
  • 2021-01-17 20:25

    If you need to put a single property in a file just use echo:

    <echo output="somefiles.properties">lastmodified=${lastmodified}</echo>
    
    0 讨论(0)
  • 2021-01-17 20:27

    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>
    
    0 讨论(0)
  • 2021-01-17 20:37

    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.

    0 讨论(0)
提交回复
热议问题