问题
I have a requirement where I need to search the existence of a set of files and if in case the file does not exist throw a build failure error, after much searching , I have found this code and it works on 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>
But the issue is we are using the version of ANT (ANT1.6) that comes bundled along with WebSphere since the ANT frame work of ours uses WebSphere Customized ANT definitions so to migrate ANT I need to migrate my WebSphere environment , I have planned to download the ANT1.7.1 jar and tried as below
<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>
but Still i have the below build failure error
taskdef class org.apache.tools.ant.taskdefs.ResourceCount.class cannot be found
Can you please let me know if I am following the correct approach if not is there any way the same logic could be achieved by ANT1.6 or ant-contrib.
Please help me
来源:https://stackoverflow.com/questions/23528372/include-ant1-7-1-jar-in-my-build-xml-for-taskdefs-resourcecount