有没有办法在执行之前检查jar的类路径taskdef.
例如,我想用一个条件来包围以下内容,该条件检查org.hibernate.tool.ant.HibernateToolTask在执行之前是否可以拥有该类的jartaskdef
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="hibernatetool-classpath" />
Run Code Online (Sandbox Code Playgroud)
这应该工作:
<available
property="hibernatetoolok"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="hibernatetool-classpath" />
<target name="hibernatetool" if="hibernatetoolok">
<taskdef
name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="hibernatetool-classpath" />
</target>
Run Code Online (Sandbox Code Playgroud)
然后在使用hibernatetool任务的任何目标上,确保添加depends ="hibernatetool".