如何将HtmlUnit包含在Kotlin项目中
我正在尝试在Kotlin项目中使用HtmlUnit ,但编译时出现以下错误:
Error:Kotlin: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath: class com.gargoylesoftware.htmlunit.html.DomElement, unresolved supertypes: ElementTraversal
这是因为ElementTraversal是一个Java 7function。 我该如何解决这个问题?
org.w3c.dom.ElementTraversal
是xml-apis
一部分,它是xerces:xercesImpl
的依赖项。 xerces:xercesImpl
又是htmlunit
的依赖项。
确保将htmlunit
的传递依赖项添加到您的项目中。
使用gradle,所有需要的是:
compile 'net.sourceforge.htmlunit:htmlunit:2.22'