如何在outputfilterchain中替换ant中的换行符?

如何在outputfilterchain中替换ant中的换行符?,ant,Ant,在我的build.xml中,我想做与cmd1 | xargs cmd2(并将cmd1中的文件列表存储到变量${dependencies})中,其中cmd1给出了一个换行分隔的路径列表。我不知道如何在Ant中实现这一点 <project default="main"> <target name="main"> <exec executable="echo" outputproperty="dependencies"&g

在我的build.xml中,我想做与
cmd1 | xargs cmd2
(并将
cmd1
中的文件列表存储到变量
${dependencies}
)中,其中
cmd1
给出了一个换行分隔的路径列表。我不知道如何在Ant中实现这一点

<project default="main">
    <target name="main">
        <exec executable="echo"
             outputproperty="dependencies">
            <arg value="closure/a.js&#xa;closure/b.js&#xa;closure/c.js"/>
            <redirector>
                <outputfilterchain>
                    <replacestring from="${line.separator}" to=" "/>
                    <!-- None of these do anything either:
                    <replacestring from="\n" to=" "/>
                    <replacestring from="&#xa;" to=" "/>
                    <replaceregex pattern="&#xa;" replace=" " flags="m"/>
                    <replaceregex pattern="\n" replace=" " flags="m"/>
                    <replaceregex pattern="${line.separator}" replace=" " flags="m"/>
                    -->
                </outputfilterchain>
            </redirector>
        </exec>
        <!-- Later, I need to use each file from ${dependencies} as an argument
             to a command. -->
        <exec executable="echo">
          <!--This should turn into 3 arguments, not 1 with newlines.-->
          <arg line="${dependencies}"/>
        </exec>
    </target>
</project>

此筛选器可能适用于第一部分-它假定所有文件都不以空格字符开头

<outputfilterchain>
    <prefixlines prefix=" " />
    <striplinebreaks />
    <trim />
</outputfilterchain>


它在每一行的前面加一个空格,然后删除换行符,即用一行空格分隔所有文件名,但在开头加一个空格。所以
修剪
用于将其切掉。

谢谢martin。在仔细阅读之后,我也找到了另一个解决方案

<outputfilterchain>
    <tokenfilter delimoutput=" ">
        <!--The following line can be omitted since it is the default.-->
        <linetokenizer/>
    </tokenfilter>
</outputfilterchain>