gpt4 book ai didi

gradle - Jaxp问题?使用gradle无法找到org.apache.xerces.jaxp.DocumentBuilderFactoryImpl

转载 作者:行者123 更新时间:2023-12-03 06:24:51 27 4
gpt4 key购买 nike

我在让类加载到gradle脚本中遇到麻烦。当我运行此代码时:

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath( group:"xerces", name:'xercesImpl', version:'2.9.1')
}
}

task hello {
doLast {
println 'Hello world!'
Class testClass = Class.forName("org.apache.xerces.jaxp.DocumentBuilderFactoryImpl")
assert testClass: "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found"
println "found"
}
}

当我运行“gradle hello”时,我得到了这个:
java.lang.ClassNotFoundException:org.apache.xerces.jaxp.DocumentBuilderFactoryImpl“

我怀疑Jaxp的实现问题,但是对jaxp的工作原理并不了解。

谢谢你的帮助

最佳答案

这样就足够了吗?

import org.apache.xerces.jaxp.DocumentBuilderFactoryImpl;

buildscript {
repositories {
mavenCentral()
}

dependencies {
classpath group:"xerces", name:'xercesImpl', version:'2.9.1'
}
}

task hello {
println 'Hello world!'
DocumentBuilderFactoryImpl obj = new DocumentBuilderFactoryImpl()
// do something with obj
}

关于gradle - Jaxp问题?使用gradle无法找到org.apache.xerces.jaxp.DocumentBuilderFactoryImpl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5999703/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com