Java Ant在try-catch块中失败
在我的ANT构建中,我有以下代码:Java Ant在try-catch块中失败,java,ant,try-catch,ant-contrib,Java,Ant,Try Catch,Ant Contrib,在我的ANT构建中,我有以下代码: <trycatch reference="exception_ref"> <try> <echo>Start Building Delivery</echo> </try> <catch> <property name="exception" refid="exception_ref" /> <pro
<trycatch reference="exception_ref">
<try>
<echo>Start Building Delivery</echo>
</try>
<catch>
<property name="exception" refid="exception_ref" />
<property name="message" value="Error in trycatch block:${line.separator}${exception}" />
<echo message="${message}" />
<fail message="${message}" />
</catch>
<finally>
<echo>Finally</echo>
</finally>
</trycatch>
开始建筑交付
最后
蚂蚁说:
问题:无法创建任务或键入trycatch原因:名称未定义。 操作:检查拼写。
操作:检查是否已声明任何自定义任务/类型。
措施:检查是否发生了任何/声明 我错过了什么
//编辑:我正在Eclipse中使用ANT,trycatch是第三方库提供的任务。确保下载他们的Jar并在Ant类路径上引用它。请参阅以了解如何执行此操作 在Eclipse上,转到窗口->首选项->Ant->Runtime。在类路径选项卡下,使用“添加外部jar…”按钮添加Ant Contrib jar。如链接中所述,您需要按如下方式声明任务:
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
我正在eclipse中使用ANt。如何设置?使用antcontrib.properties的taskdef定义错误。antcontrib.properties只包含ant<1.6的taskdefs,声明如下(假设antcontrib.jar已经在路径上):。。。或者没有名称空间:。。。