Reputation: 7046
I know ant-contrib has a for loop, but I'd rather avoid adding it to my project unless necessary. It feels like I'm missing something obvious here. I just want to execute a task for a lot of files.
Upvotes: 2
Views: 2227
Reputation: 4826
If you are trying to run an external program on a bunch of files take a look at Ant's apply task.
Upvotes: 4
Reputation: 2247
Another option, especially if you're using Java 6, is to use <scriptdef>
. A little JavaScript goes a long way.
(Theoretically <scriptdef>
works prior to Java 6, but you have to include an interpreter for your selected scripting language. You might as well just use antcontrib then. Java 6 includes the Rhino JavaScript interpreter by default, so it's much easier to use.)
In fact, this is so easy to do I've found myself writing scripts for things that could be in Ant but are just very complex.
Upvotes: 1
Reputation: 2558
Probably the best and most complete option is to just write a <taskdef>
for a Java class that you write that can do what ever you can think up. See the ant manual for more info on taskdef
Upvotes: 0