蚂蚁:复制相同的文件集多个地方 [英] Ant: copy the same fileset to multiple places
本文介绍了蚂蚁:复制相同的文件集多个地方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个Ant脚本,将一个文件夹复制到其他几个地方。作为一名优秀的程序员听话,我想不重复自己。是否有服用一个文件集这样的任何方式:
I need an Ant script that will copy one folder to several other places. As a good obedient programmer, I want not to repeat myself. Is there any way of taking a fileset like this:
<copy todir="${target}/path/to/target/1">
<fileset dir="${src}">
<exclude name='**/*svn' />
</fileset>
</copy>
和存储文件集
在一个变量,因此它可以被重新利用?
And storing the fileset
in a variable so it can be re-used?
推荐答案
在文件集声明一个id属性,然后引用它在每个副本的任务。
Declare an id attribute on the fileset and then reference it in each copy task.
例如:
<project name="foo">
<fileset id="myFileSet" dir="${src}">
<exclude name='**/*svn' />
</fileset>
...
<target name="copy1">
<copy todir="${target}/path/to/target/1">
<fileset refid="myFileSet"/>
</copy>
</target>
<target name="copy2">
<copy todir="${target}/path/to/target/2">
<fileset refid="myFileSet"/>
</copy>
</target>
</project>
这篇关于蚂蚁:复制相同的文件集多个地方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文