【问题标题】:Running TestNG test case from ANT giving DomSource cannot be proccesed?无法处理从 ANT 提供 DomSource 的 TestNG 测试用例?
【发布时间】:2013-03-08 09:15:31
【问题描述】:

我有一个运行 testNG testCase 的 ant 任务。但是在运行时它显示如下错误

 [testng] Error 
 [testng]   DOMSource cannot be processed: check that saxon8-dom.jar is on the classpath
 [testng] [GeneralXMLOutput] [Error] DOMSource cannot be processed: check that saxon8- dom.jar is on the classpath

我的 lib 文件夹包含与 xml 相关的 jdom-0.7.jar、saxon-8.7.jar、SaxonLiasion.jar。是jar文件依赖冲突吗?

如何解决这个错误?

蚂蚁任务

 <target name="runTests" depends="compile">
    <testng classpath="${test.classpath}:${build.dir}">
        <xmlfileset dir="${basedir}" includes="testng.xml" />
    </testng>
</target>

我在其他一些类中使用了来自 rt.jar 的 javax.xml.transform.Transformer api 并且 saxon 也有 Transformer Api。(这是否会产生问题?)

问候,

【问题讨论】:

    标签: dom ant jar testng saxon


    【解决方案1】:

    消息很清楚:检查 saxon8-dom 是否在类路径中。从你说的情况来看,不是。

    但是 Saxon 8.7 无论如何都是一个古老的版本,当前版本是 9.4。最近的版本包括主 JAR 文件中的 DOM 支持 - 过去将其分开的原因是因为 DOM API 在 JDK 1.4 和 JDK 1.5 之间以不兼容的方式更改,而当 Saxon 放弃对 JDK 1.4 的支持时,这个问题就消失了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-24
      • 2011-05-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多