如何在apache ant中不存在pathelement时失败? [英] How to fail on pathelement not exists in apache ant?
本文介绍了如何在apache ant中不存在pathelement时失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个使用
部分的非常长的类路径.在另一台机器上,很多罐子都不存在.如何检查所有路径元素是否存在?
I have a really long class path using a <path />
section. On a different machine, lots of the jars dont exist. How can I check the pathelements all exist?
推荐答案
使用 当前选择器 :
<project>
<fileset dir="/home/rosebud/temp/dir1" includes="*.jar" id="srcfileset">
<present present="srconly" targetdir="/home/rosebud/temp/dir2"/>
</fileset>
<echo>Missing files => ${toString:srcfileset}</echo>
</project>
回显仅存在于/home/rosebud/temp/dir1 中的所有文件
如果/home/rosebud/temp/dir1 中的所有文件都存在于/home/rosebud/temp/dir2 中,则文件集将为空.
echoes all files only present in /home/rosebud/temp/dir1
If all files from /home/rosebud/temp/dir1 would be present in /home/rosebud/temp/dir2, the fileset would be empty.
如果您需要在丢失文件的情况下完成构建,请使用:
If you need to finish your build in case of missing files use :
<project>
<fileset dir="/home/rosebud/temp/dir1" includes="*.jar" id="srcfileset">
<present present="srconly" targetdir="/home/rosebud/temp/dir2"/>
</fileset>
<fail message="Missing files => ${toString:srcfileset}">
<condition>
<resourcecount refid="srcfileset" when="greater" count="0" />
</condition>
</fail>
</project>
这篇关于如何在apache ant中不存在pathelement时失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文