ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Stevens" <>
Subject Re: Is it possible to run a target for each file in a fileset?
Date Thu, 26 Jun 2008 10:04:11 GMT
2008/6/24 Rebhan, Gilbert <>:
> -----Original Message-----
> From: Andy Stevens
>>  I haven't found a way to combine the echo & java commands into a
>> single command line (separating them with ; just makes it ignore the
>> second command) so I'm wondering if it's possible to loop over the
>> fileset and call a separate target (containing <echo> and <java>
>> tasks) for each one in turn, passing the filename in a
>> property/parameter?  Kind of like a cross between the <apply> and
>> <ant>/<antcall> tasks.
>> Is that possible, or is the batch file going to be the easiest way to
>> do what I need?  Or can anyone suggest another way I've not thought
>> of?
> maybe with <for> task from antcontrib =
> <fileset dir="..." includes="yourpattern" id="yourID"/>
> <for list="${toString:yourID" param="filename">
>  <sequential>
> <echo>... process file => @{filename}
>  your <java ...> call goes here with @{filename} as input
>  </sequential>
> </for>

Thanks, everyone, for the suggestions.  Sounds like <for> is probably
the way to go - I found a build script from another of our projects
that already uses it (looks like Netbeans' mobility pack includes the
ant-contrib jar, and luckily I did include that option when I
installed it).

Another possiblity I was wondering about, given jslint is itself
written in javascript, was using the <script> optional task to run it
rather than calling Rhino.  Ideally, I'd use the src attribute to read
in an unmodified jslint.js then some inline javascript to set up
various options and call it.  Can that be done in a single <script>
task, though? i.e. would it read/execute the external src file and
then execute the inline script as well?  Or, if I use more than one
<script> task in a target (one using src, one with the inline script)
would the objects/functions defined in the first one still be
available in the subsequent task or does each one run in a completely
separate/clean context?

--  Open source java Sudoku application

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

View raw message