1

I've 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, such as propertyregex, this works fine. But when I try to use the postMethod task I get the following error:

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

Any suggestions on what to do to resolve this?

4

2 回答 2

2

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.

于 2009-10-23T10:48:14.923 回答
0

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.

于 2009-10-23T20:18:36.647 回答