蚂蚁检查类路径的taskdef前罐子 [英] ant check classpath for jar before taskdef

查看:197
本文介绍了蚂蚁检查类路径的taskdef前罐子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在执行前检查一罐类路径中的的taskdef

例如,我想围绕与检查的情况下,如果能有类 org.hibernate.tool.ant.HibernateToolTask​​ 执行前的罐子的taskdef

 <的taskdef NAME =hibernatetool类名=org.hibernate.tool.ant.HibernateToolTask​​classpathref =hibernatetool类路径/>


解决方案

这应该工作:

 <可用
      财产=hibernatetoolok
      类名=org.hibernate.tool.ant.HibernateToolTask​​
      classpathref =hibernatetool类路径/><目标名称=hibernatetool如果=hibernatetoolok>
  <的taskdef
    NAME =hibernatetool
    类名=org.hibernate.tool.ant.HibernateToolTask​​
    classpathref =hibernatetool类路径/>
< /目标与GT;

然后,你在哪里使用hibernatetool任务一定要添加任何目标取决于=hibernatetool。

Is there a way to check the classpath for a jar before executing a taskdef.

For example, I want to surround the following with a condition that checks if a jar that can has the class org.hibernate.tool.ant.HibernateToolTask before executing the taskdef

<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"  classpathref="hibernatetool-classpath" />

解决方案

This should work:

<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>

Then on any target where you use the hibernatetool task be sure to add depends="hibernatetool".

这篇关于蚂蚁检查类路径的taskdef前罐子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆