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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Use the present selector :
<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>
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>