蚂蚁遍历文件 [英] ant iterate over files

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

问题描述

我想遍历一个 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>

但是我如何迭代它们?我没有蚂蚁贡献

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

谢谢!

推荐答案

如果您无权访问 ant-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):

如果你使用 <subant>genericantfile 属性,它有点像 <antcall> 调用一个目标包含任务的构建文件.
不同, 接受一个目录列表或一组目录,并将为每个设置项目基本目录的目录调用一次目标.

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天全站免登陆