将java中完成的TestNG项目从maven .pom文件移动到gradle build.gradle。我能够让大部分内容正常工作,但是在运行测试时我遇到了错误。
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [ApplicationBeans.xml]; nested exception is java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
我在测试框架代码中使用了spring框架。
使用以下gradle文件:
apply plugin: 'java'
dependencies {
compile project(':qa_common')
testCompile(group: 'org.uncommons', name: 'reportng', version:'1.1.4') {
exclude(module: 'testng')
}
testCompile group: 'com.google.inject', name: 'guice', version:'3.0'
compile group: 'xml-apis', name: 'xml-apis', version:'1.4.01'
}
task testDiscounts(type: Test) {
useTestNG() {
suites 'src/test/resources/testsuites/env_qa/TestSuite.xml'
}
}
task packageTests(type: Jar) {
from sourceSets.test.output
classifier = 'tests'
}
artifacts.archives packageTests
谁能告诉我哪里出错了?