蚂蚁修改特性文件,但转义字符 [英] Ant modifying property file but escaping characters

查看:86
本文介绍了蚂蚁修改特性文件,但转义字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个修改属性文件Ant构建脚本。当赔偿与新路径的属性,似乎逃脱反斜杠和冒号。我明白这是可能如预期,但批处理文件,进一步使用该属性文件在下跌过程中,这是造成错误。

有一只蚂蚁的解决这个,或者我应该开始寻找一个shell脚本的解决方法?

谢谢,
BON

Ant目标

 <目标名称=modify_workstation_properties取决于=loadWinEnvVars,loadUnixEnvVars>
    < propertyfile文件=$ {} BASEDIR /Deliverables/config/framework_setup/workstation.properties>
        <输入键=toplevel.project.dir值=$ {} BASEDIR/>
        <输入键=root.project.dir值=$ {} BASEDIR /建筑/>
        <输入键=root.dir值=$ {BASEDIR} /框架/建筑/ netc_os/>
        <输入键=jdk.home值=$ {} JDKHOME/>
        <输入键=wls.home值=$ {} WLSHome/>
        <输入键=domain.dir值=$ {} DomainDir/>
        <输入键=stage.dir值=$ {} DomainDir/>
    < / propertyfile>
< /目标与GT;

输出:

 新工作项目#顶级的根目录
toplevel.project.dir = C \\:\\\\ \\\\ forImage r16_dev_deploy新的工作项目#的根目录
root.project.dir = C \\:\\\\ \\\\ forImage r16_dev_deploy /建筑框架项目#的根目录
root.dir = C \\:\\\\ \\\\ forImage r16_dev_deploy /框架/建筑/ netc_os
...


解决方案

没有你不能修改属性的编写方式。该文件被写入但是之后您可以使用 ReplaceRegExp 任务和纠正转义字符

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
...

解决方案

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.

这篇关于蚂蚁修改特性文件,但转义字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆