Ant modifying property file but escaping characters

时光怂恿深爱的人放手 提交于 2019-12-10 15:59:46

问题


I have an ant build script that is modifying a properties file. When it amends the properties with the new paths, it seems to escape the back slashes and colons. I understand this is probably working as intended but batch files use this property file further down the process and it is causing errors.

Is there an ant solution to this, or should I start looking at a shell script workaround?

Thanks, BON

Ant target:

    <target name="modify_workstation_properties" depends="loadWinEnvVars, loadUnixEnvVars">
    <propertyfile file="${basedir}/Deliverables/config/framework_setup/workstation.properties">
        <entry key="toplevel.project.dir" value="${basedir}"/>
        <entry key="root.project.dir" value="${basedir}/Construction"/>
        <entry key="root.dir" value="${basedir}/Framework/Construction/netc_os"/>
        <entry key="jdk.home" value="${JDKHome}"/>
        <entry key="wls.home" value="${WLSHome}"/>
        <entry key="domain.dir" value="${DomainDir}"/>
        <entry key="stage.dir" value="${DomainDir}"/>
    </propertyfile>
</target>

Output:

# Top Level Root directory of the new working project
toplevel.project.dir=C\:\\forImage\\r16_dev_deploy

# Root directory of the new working project
root.project.dir=C\:\\forImage\\r16_dev_deploy/Construction

# Root directory of the framework project
root.dir=C\:\\forImage\\r16_dev_deploy/Framework/Construction/netc_os
...

回答1:


No you can't modify the way that the properties are written. However after the file is written you could use the ReplaceRegExp task and correct the escaped characters.



来源:https://stackoverflow.com/questions/7428416/ant-modifying-property-file-but-escaping-characters

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!