我有一个要求,我需要搜索一组文件的存在,如果文件不存在则抛出构建失败错误,经过多次搜索,我找到了这个代码,它适用于ANT1.7.1
<target name="validate.file" depends="defineAnt7,validate.dir">
<echo message = " The Filelist is : ${file.list} "/>
<condition property="is.missing">
<resourcecount when="ne" count="0">
<difference id="is.missing">
<intersect>
<filelist id="required" dir="${target.location}" files="${file.list}"/>
<fileset id="existing" dir="${target.location}" includes="*.*"/>
</intersect>
<filelist refid="required"/>
</difference>
</resourcecount>
</condition>
<fail if="is.missing" message= " File ${toString:missing} is missing from the list of files provided for removing, please recheck and submit correct "/>
</target>
但问题是我们正在使用与WebSphere捆绑在一起的ANT(ANT1.6)版本,因为我们的ANT框架工作使用WebSphere Customized ANT定义,因此迁移ANT我需要迁移我的WebSphere环境,I我打算下载ANT1.7.1 jar并尝试如下
<target name = "defineAnt7" description="retreive dependencies with ANT1.7">
<echo message = "Present in Ant 1.7.1 "/>
<taskdef name="resourcecount" classname="org.apache.tools.ant.taskdefs.ResourceCount.class">
<classpath>
<!--<pathelement location="/jass/deploy-process/deploy-engine/build/lib/apache-ant-1.7.1.jar"/> -->
<fileset dir="/jass/deploy-process/deploy-engine/build/lib" includes ="apache-ant-1.7.1.jar" />
</classpath>
</taskdef>
</target>
但仍然有以下构建失败错误
taskdef class org.apache.tools.ant.taskdefs.ResourceCount.class cannot be found
如果没有任何方法可以通过ANT1.6或ant-contrib实现相同的逻辑,请告诉我是否遵循了正确的方法。
请帮帮我