处理多个文件的 Ant 任务 [英] Ant task that processes multiple files

查看:28
本文介绍了处理多个文件的 Ant 任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Ant 中,我想在文件集上执行 Java 任务.我使用 Java 任务来运行运行 JS 美化器的犀牛.后者的工作没有任何问题,只是使用 rhino+js 来实际拥有一个有效的 JS 美化器/压头似乎有点尴尬.但是我发现的所有可用的 JS 美化器都是用 JavaScript 编写的.

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.

我也想在文件上运行 jsmin,但作为分发任务的一部分.所以同样的问题会再次出现,例如在多个文件上运行一个 java 任务.jsmin 的 java/JS 实现是首选,因为它适用于运行 ant 的所有平台.

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.

我在 ant 中找不到处理文件集或类似结构的通用foreach"任务.我用谷歌搜索 ant 找到了一个提供foreach"的附加包,但由于它不是标准 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.

exec 任务可以遍历文件集,但我想在 JVM 内或至少在分叉的 JVM 上运行 rhino.但作为最后的手段,当然可以在外部执行 java,也许这是首选方式.

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.

推荐答案

答案是ant-contrib.

特别是foreach 任务

这篇关于处理多个文件的 Ant 任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆