有一種基於外部Tasksuite的解決方案,稱爲Ant Flaka。 使用Ant Flaka,您可以訪問文件集中的基礎文件對象及其屬性(名稱,mtime,大小..)。無需通過打開外部過程中應用/ CMD
<project name="demo" xmlns:fl="antlib:it.haefelinger.flaka">
<fl:install-property-handler />
<!-- as fileset has no absolute pathnames we need
path combined with pathconvert -->
<path id="foobar">
<fileset dir="/home/gilreb/Downloads">
<include name="*.zip"/>
</fileset>
</path>
<pathconvert property="zipfiles" refid="foobar"/>
<!-- iterate over the listentries, get access to
the underlying fileobject and echo its properties -->
<fl:for var="f" in="split('${zipfiles}', ':')">
<echo>
#{ format('filename %s, last modified %tD, size %s bytes', f.tofile.toabs,f.tofile.mtime,f.tofile.size) }
</echo>
</fl:for>
</project>
輸出=
...
[echo] filename /some/path/apache-ant-1.8.2-bin.zip, last modified 03/16/11, size 10920710 bytes
[echo]
[echo] filename /some/path/apache-ant-1.8.2-src.zip, last modified 03/16/11, size 8803388 bytes
[echo]
[echo] filename /some/path/apache-ant-antunit-1.1-bin.zip, last modified 04/17/11, size 70477 bytes
...
謝謝!我掉進了這個罐子裏,對EL做了一些小修改,而且它工作正常。 Flaka是Ant非常需要的補充。 – 2011-05-14 11:32:45