ant copy filterset

Zac*_*ack 3 ant filter

为什么下面的代码不起作用?在创建的新文件中,filterset不会执行单个替换

<copy file="${WT_HOME}/conf/auditing/configAudit.xml"
      tofile="${WT_HOME}/conf/auditing/configAudit1.xml" 
      overwrite="true">
    <filterset>
        <filter token="false" value="true"/>
    </filterset>
</copy>
Run Code Online (Sandbox Code Playgroud)

kro*_*ock 6

您使用的过滤器将@false@使用该值替换标记true.它不会翻转falsetrue我假设你正在尝试做的事情.如果要将true的出现替换为true,则可能需要查看使用replace任务.


小智 6

迟到的答案,但此页面在Google的"ant copy filter replace"搜索结果中排名很高:

尝试使用tokenfilter / replacecestring instaed过滤链:

<copy file="${WT_HOME}/conf/auditing/configAudit.xml" tofile="${WT_HOME}/conf/auditing/configAudit1.xml" overwrite="true">
    <filterchain>
        <tokenfilter>
             <replacestring from="false" to="true"/>
        </tokenfilter>
    </filterchain>
</copy>
Run Code Online (Sandbox Code Playgroud)