开发者

org/apache/commons/codec/DecoderException when integrating Ant-Contrib into Eclipse

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 lib开发者_Go百科s, 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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜