代码之家  ›  专栏  ›  技术社区  ›  B.E.

将ant contrib集成到Eclipse时的org/apache/commons/codec/decoderException

  •  1
  • B.E.  · 技术社区  · 15 年前

    我尝试将ant contrib 1.0b3集成到Eclipse中,方法是将ant-contrib-1.0b3.jar和libs目录中的appendant jar文件添加到Eclipse中Ant Runtime Preferences页面的“global entries”部分。

    对于不需要libs的任务,例如 propertyregex ,这个很好用。 但当我尝试使用 postMethod 任务我得到以下错误:

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

    关于如何解决这个问题有什么建议吗?

    2 回复  |  直到 13 年前
        1
  •  2
  •   martin clayton egrunin    15 年前

    看起来你的装备不包括 Apache Commons Codec 它必须是Ant-Contrib的依赖项。

    根据依赖关系 here 你可能还需要 commons-logging 但你可能已经知道了。

        2
  •  0
  •   Alexander Pogrebnyak    15 年前

    在构建文件中定义第三方任务时,指定类路径要干净得多。 提供单个罐或添加 <fileset> 依赖jar到类路径,例如

    <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>
    

    可以定义默认值 ant-contrib.jar ant-contrib-dependency.lib 此生成文件中的属性,并在Ant生成工具vm参数中提供特定于项目的重写。这意味着您不必将这些文件复制到系统上的不同目录中。

    推荐文章