Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Date ant时间格式反斜杠问题_Date_Ant_Properties File - Fatal编程技术网

Date ant时间格式反斜杠问题

Date ant时间格式反斜杠问题,date,ant,properties-file,Date,Ant,Properties File,我有一个ant build.xml来创建/修改带有以下标记的version.properties文件: <propertyfile file="${version.file}" comment="Build version info"> <entry key="buildDate" type="date" value="now" pattern="MM-dd-yyyy HH:mm:ss"/> 有没有办法消除结果中的这些反斜

我有一个ant build.xml来创建/修改带有以下标记的version.properties文件:

<propertyfile
            file="${version.file}" comment="Build version info">
            <entry key="buildDate" type="date" value="now" pattern="MM-dd-yyyy HH:mm:ss"/>

有没有办法消除结果中的这些反斜杠?

propertyfile
使用
java.util.Properties
对象将属性存储在文件中。根据以下文件:

对于键,所有空格字符都使用前面的\字符写入。对于元素,前导空格字符(而非嵌入或尾随空格字符)使用前一个\字符写入键和元素字符#、!、=,和:用前面的反斜杠书写,以确保正确加载。

因此,您不必担心反斜杠-如果在构建文件中读回属性文件,它们将被忽略。如果出于某种原因必须删除反斜杠,则需要解析文件并手动删除它们(例如,使用某种正则表达式)

buildDate=01-28-2015 15\:49\:57