如何在失败中pathelement Apache Ant的不存在? [英] How to fail on pathelement not exists in apache ant?

查看:305
本文介绍了如何在失败中pathelement Apache Ant的不存在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用&LT一个很长的类路径; GT路/&; 部分。在不同的机器,大量的罐子不存在。我如何检查pathelements都存在吗?

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?

推荐答案

使用的 present选择

<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>

呼应了所有文件仅present在/ home /玫瑰花蕾/温度/ DIR1结果
如果从/家/玫瑰花蕾/温度/ dir1的所有文件会在/ home /玫瑰花蕾/温度/ DIR2 present,文件集将是空的。

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>

这篇关于如何在失败中pathelement Apache Ant的不存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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