java - Ant fails in try catch block -
in ant build have following code:
<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>   ant says:
problem: failed create task or type trycatch cause: name undefined. action: check spelling. action: check custom tasks/types have been declared. action: check / declarations have taken place.
what missing here?
// edit: using ant in eclipse
trycatch task provided ant-contrib third-party library. make sure download jar , have referenced on ant classpath. see this link how this.
on eclipse, go window -> preferences -> ant -> runtime. under classpath tab, add ant-contrib jar using "add external jars..." button. , mentioned in link, need declare tasks follows:
<taskdef resource="net/sf/antcontrib/antlib.xml"/>      
Comments
Post a Comment