Getting an error "Could not load definitions from resource net/sf/antcontrib/antcontrib.properties. It could not be found."

gauravhalbe picture gauravhalbe · Mar 9, 2013 · Viewed 79.1k times · Source

I am getting an error Could not load definitions from resource net/sf/antcontrib/antcontrib.properties. It could not be found. when I am trying to ant build on eclipse. So I downloaded ant-contrib-0.6.jar and kept it in my /lib location of apache ant, but it still does not resolve my issue. I have also tried by specifying the /lib location in my CLASSPATH system variable. How can I get around this error?

Answer

Boris Brodski picture Boris Brodski · Mar 11, 2013

You can provide full path to the ant-contrib JAR explicitly using "classpath" element:

<taskdef resource="net/sf/antcontrib/antlib.xml">
  <classpath>
    <pathelement location="${path-to-ant-contrib}/ant-contrib-1.0b3.jar"/>
  </classpath>
</taskdef>