`

Ant常见属性解析--condition ,available

    博客分类:
  • Ant
阅读更多
判断文件存不存在

<?xml version="1.0"?>

<project default="check-runtime" basedir=".">

   <condition property="binding-jars-found">
	<and>
	  <available file="${jibx-home}/bcel.jar" />

	 </and>
   </condition>


  <target name="check-runtime">
	<fail unless="runtime-jars-found">
Required JiBX runtime jar jibx-run.jar was not found in JiBX home lib directory 
         </fail>
  </target>
  
</project>


此外也可以运用available 进行同样的判断
<available file="${st.report.file}" property="st.report.valid" /> 
<fail message="${st.report.file}" unless="st.report.valid" /> 


<available file="${appconfig.dir}/rule" type="dir" property="rule.present" /> 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics