views:

312

answers:

1

Hi, in Ant I want to execute a Java task on a fileset. I use the Java task to run rhino which runs a JS beautifier. The later works without any problems, except that it might seem little bit awkward to use rhino+js to acutally have a working JS beautifier/indenter. But all working JS beautifiers I have found are all written in JavaScript.

I also want to run jsmin on the files as well, but as part of the distribution task. So the same problem will appear again, e.g running a java task on multiple files. The java/JS implementation of jsmin is preferred since it works on all platforms that run ant.

I cannot find a generic "foreach" task in ant that processes a fileset or similar structure. I have googled ant found an add-on package that provides "foreach" but since its not part of the standard ant core tasks I get the feeling that I'am on the wrong track.

The exec task can iterate over a fileset, but I want to run rhino inside the JVM or at least on a forked JVM. But as a last resort it is of course possible to exec java externally, maybee that is the preferred way.

+2  A: 

The answer is ant-contrib.

Specifically foreach task

Alexander Pogrebnyak
Ok, I found ant-contrib listed under "Related projects" on ant.apache.org so I consider it a pretty standard add-on so I'll chose that solution.
Ernelli