ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Hatcher" <>
Subject Re: file expansion for <arg>???
Date Fri, 19 Oct 2001 22:58:03 GMT

Have you tried the <apply> task?  Its made to launch a command-line program
for each item in a fileset, but it might not be quite what you need given
that your example is for a passing a list of files to a Java program.

It seems that the best solution is for you to write a wrapper Task that
accepts a fileset and calls the Java program under the hood, either by
launching it through command-line or instantiating a class and invoking
methods directly.


----- Original Message -----
From: "Don Ledford" <>
To: <>
Sent: Friday, October 19, 2001 5:30 PM
Subject: file expansion for <arg>???

> I finally bit the bullet and I'm switching from make
> to ant for my Java projects.  And I've pretty much
> got everything figured out, BUT this one item:
> How to I get file name expansion for tasks which use
> the <arg> element to define command line arguments?
> Specifically I'd like to run a Java application for
> on all files with a certain extension.
> In shell-eez:  java myClass *.pat
> In ant's build.xml:
>     <java classname="myClass" classpath="mystuff.jar" >
>         <arg value="x.pat" />
>         <arg value="y.pat" />
>         <arg value="z.pat" />
>     </java>
> If I use "*.pat" for the value, line, or file attributes
> of the arg element - I don't get file expansion.
> And - the arg element doesn't allow sub-ordinate fileset
> elements. Nor does it support the "includes" attribute.
> Either I'm missing something - or - I can't be the only
> person who wants to run java applications in their ant
> build files. I suppose I could make my applications valid
> ant target elements, but this seems excessive.
> --
> Don Ledford

View raw message