tags:

views:

749

answers:

2

I tried to integrate Ant-Contrib 1.0b3 into Eclipse by adding the ant-contrib-1.0b3.jar and the appendant jar-files from the libs-directory to the "Global Entries"-section of the Ant-Runtime-preferences page in Eclipse.

For tasks that don't need the libs this works fine (such as propertyregex), but when I try to use the postMethod task I get the following error:

java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException

Any suggestions?

A: 

It looks like your rig doesn't include the Apache Commons Codec which must be a dependency of ant-contrib.

According to the dependencies here you might also need commons-logging, but you've probably already got that.

martin clayton
A: 

It's much cleaner to specify classpath when you define 3rd-party tasks in your build file. Provide either individual jars or add a <fileset> of dependent jars to classpath, e.g.

<taskdef
  resource="net/sf/antcontrib/antlib.xml"
  uri="http://ant-contrib.sourceforge.net"
>
  <classpath>
    <pathelement location="${ant-contrib.jar}"/>
    <fileset dir="${ant-contrib-dependency.lib}">
      <include name="*.jar"/>
    </fileset>    
  </classpath>
</taskdef>

You can define default ant-contrib.jar and ant-contrib-dependency.lib properties in this build file, and provide project specific overrides in ant build tool VM arguments. This means you don't have to copy these files into various directories on your system.

Alexander Pogrebnyak