如何在 Kotlin 项目中包含 HtmlUnit
How to include HtmlUnit in a Kotlin project
我正在尝试在 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 7 的功能。我该如何解决?
org.w3c.dom.ElementTraversal
是 xml-apis
which is a dependency of xerces:xercesImpl
. The xerces:xercesImpl
is in turn a dependency of htmlunit
的一部分。
确保将 htmlunit
的传递依赖项添加到您的项目中。
有了gradle,只需要:
compile 'net.sourceforge.htmlunit:htmlunit:2.22'
我正在尝试在 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 7 的功能。我该如何解决?
org.w3c.dom.ElementTraversal
是 xml-apis
which is a dependency of xerces:xercesImpl
. The xerces:xercesImpl
is in turn a dependency of htmlunit
的一部分。
确保将 htmlunit
的传递依赖项添加到您的项目中。
有了gradle,只需要:
compile 'net.sourceforge.htmlunit:htmlunit:2.22'