在文件蚂蚁迭代 [英] ant iterate over files

查看:156
本文介绍了在文件蚂蚁迭代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要遍历jar文件列表(未定义号码),他们都加入到jar文件。
要添加他们,我打算用这样的:

I want to iterate over a list of jars (undefined number) and add them all to the jar file. To add them I plan to use something like this:

<jar id="files" jarfile="all.jar">
   <zipfileset src="first.jar" includes="**/*.java **/*.class"/>
   <zipfileset src="second.jar" includes="**/*.java **/*.class"/>
</jar>

但我怎么遍历呢?我没有蚂蚁的contrib

but how do I iterate over them? I don't have ant-contrib

谢谢!

推荐答案

如果你没有获得的 蚂蚁的contrib 任务,你可能最终不得不定义做你所需要的自定义任务 ...

If you do not have access to ant-contrib For task, you may end up to have to define your custom Task for doing what you need...

如果您有 ant1.6 以上,你也可以尝试的 subant (见的新的Ant 1.6功能的大项目):

If you have ant1.6 and above, you can also try subant (see New Ant 1.6 Features for Big Projects):

如果您使用&LT; subant&GT;的 genericantfile 属性它种工作方式类似于&LT; antcall方式&gt; 援引包含任务相同的生成文件的目标结果
  不像&LT; antcall&GT; &LT; subant&GT; 将列表或设置目录,并会调用一次目标每个目录设置项目的基本目录。

If you use <subant>'s genericantfile attribute it kind of works like <antcall> invoking a target in the same build file that contains the task.
Unlike <antcall>, <subant> takes a list or set of directories and will invoke the target once for each directory setting the project's base directory.

如果你想在目录中任意数量的执行完全一样的操作。这是非常有用的。

This is useful if you want to perform the exact same operation in an arbitrary number of directories.

这篇关于在文件蚂蚁迭代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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