ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: Convert fileset into command-line args, allowing for spaces in directories
Date Mon, 23 Jan 2006 13:24:49 GMT
>I have a fileset, and i have a variable defining includes, and 
>one defining excludes. The fileset is created like this. This 
>works fine.
><fileset dir="${context.getVariable(dir_var_name)}" id="my.files">
>    <!-- Includes -->
>    <j:set var="include_var_name" value="my.fileset.include"/>
>    <j:if test="${context.getVariable(include_var_name) != null}">
>        <include name="${context.getVariable(include_var_name)}"/>
>    </j:if>
>    <!-- Excludes -->
>    <j:set var="exclude_var_name" value="my.fileset.exclude"/>
>    <j:if test="${context.getVariable(exclude_var_name) != null}">
>        <exclude name="${context.getVariable(exclude_var_name)}"/>
>    </j:if>

hmm, dont know what this stuff should do. But if it works for you,
I can skip that ...

><pathconvert pathsep=";" property="theCommandLineFiles" 
>refid="my.files"/> which will semicolon separate my files for 
>me ... ok, but how do I then get these as command line args on 
>a <java> task ?

One string will be passed to main(String[]) when using <arg line> have
to have a look what <arg path> would do.

You can use
    <pathconvert property="p" refid="fs"
        pathsep="&quot; &quot;"
    <property name="p2" value="&quot;${p}&quot;"/>
to get a space separated (and quoted) path.

<arg path>
"A string that will be treated as a path-like string as a single
command-line argument; you can use ; or : as path separators and Ant
will convert it to the platform's local conventions."

Have you tried what comes?

BTW - have you tried <arg pathref>?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message