Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven geb联动误差_Maven_Groovy_Intellij Idea_Geb - Fatal编程技术网

Maven geb联动误差

Maven geb联动误差,maven,groovy,intellij-idea,geb,Maven,Groovy,Intellij Idea,Geb,我正试图尝试一个基本的geb脚本,不幸的是,我似乎遇到了一些严重的问题,无法将其启动 我使用IntelliJ,我从下载了geb核心jar,以及它的4个依赖项。在运行基本脚本时,我已将它们作为依赖项添加到项目结构下的IntelliJ项目中 import geb.Browser Browser.drive { go "http://google.com/ncr" } 我犯了一个看起来很严重的错误 Caught: java.lang.LinkageError: loader constra

我正试图尝试一个基本的geb脚本,不幸的是,我似乎遇到了一些严重的问题,无法将其启动

我使用IntelliJ,我从下载了geb核心jar,以及它的4个依赖项。在运行基本脚本时,我已将它们作为依赖项添加到项目结构下的IntelliJ项目中

import geb.Browser

Browser.drive {
    go "http://google.com/ncr"
}
我犯了一个看起来很严重的错误

Caught: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "com.gargoylesoftware.htmlunit.html.DomNode.getAttributes()Lorg/w3c/dom/NamedNodeMap;" the class loader (instance of org/codehaus/groovy/tools/RootLoader) of the current class, com/gargoylesoftware/htmlunit/html/DomNode, and the class loader (instance of <bootloader>) for interface org/w3c/dom/Node have different Class objects for the type org/w3c/dom/NamedNodeMap used in the signature
java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "com.gargoylesoftware.htmlunit.html.DomNode.getAttributes()Lorg/w3c/dom/NamedNodeMap;" the class loader (instance of org/codehaus/groovy/tools/RootLoader) of the current class, com/gargoylesoftware/htmlunit/html/DomNode, and the class loader (instance of <bootloader>) for interface org/w3c/dom/Node have different Class objects for the type org/w3c/dom/NamedNodeMap used in the signature
    at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:190)
    at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:268)
    at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:156)
    at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:455)
    at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329)
    at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:394)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:474)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:452)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.<init>(HtmlUnitDriver.java:181)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.<init>(HtmlUnitDriver.java:191)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.<init>(HtmlUnitDriver.java:187)
    at geb.driver.NameBasedDriverFactory.getDriver(NameBasedDriverFactory.groovy:42)
    at geb.driver.CachingDriverFactory$_getDriver_closure3.doCall(CachingDriverFactory.groovy:80)
    at geb.driver.CachingDriverFactory$_getDriver_closure3.doCall(CachingDriverFactory.groovy)
    at geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:30)
    at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:79)
    at geb.Configuration.createDriver(Configuration.groovy:354)
    at geb.Configuration.getDriver(Configuration.groovy:343)
    at geb.Browser.getDriver(Browser.groovy:105)
    at geb.Browser.go(Browser.groovy:394)
    at geb.Browser$go$1.callCurrent(Unknown Source)
    at geb.Browser.go(Browser.groovy:386)
    at gebtest$_run_closure1.doCall(gebtest.groovy:14)
    at gebtest$_run_closure1.doCall(gebtest.groovy)
    at geb.Browser.drive(Browser.groovy:860)
    at geb.Browser$drive$0.callStatic(Unknown Source)
    at geb.Browser.drive(Browser.groovy:830)
    at geb.Browser$drive.call(Unknown Source)
    at gebtest.run(gebtest.groovy:13)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
捕获:java.lang.LinkageError:接口itable初始化中的加载程序约束冲突:解析方法“com.gargoylesoftware.htmlunit.html.DomNode.getAttributes()Lorg/w3c/dom/NamedNodeMap”时;当前类的类加载程序(org/codehaus/groovy/tools/RootLoader实例),com/gargoylesoftware/htmlunit/html/DomNode,接口org/w3c/dom/Node的类加载器(的实例)对于签名中使用的类型org/w3c/dom/NamedNodeMap具有不同的类对象
java.lang.LinkageError:接口itable初始化中的加载程序约束冲突:在解析方法“com.gargoylesoftware.htmlunit.html.DomNode.getAttributes()Lorg/w3c/dom/NamedNodeMap”时;当前类的类加载程序(org/codehaus/groovy/tools/RootLoader实例),com/gargoylesoftware/htmlunit/html/DomNode,接口org/w3c/dom/Node的类加载器(的实例)对于签名中使用的类型org/w3c/dom/NamedNodeMap具有不同的类对象
位于com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:190)
在com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:268)
在com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage上(DefaultPageCreator.java:156)
在com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:455)上
在com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329)上
在com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:394)上
位于org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:474)
位于org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:452)
位于org.openqa.selenium.htmlunit.HtmlUnitDriver.(HtmlUnitDriver.java:181)
位于org.openqa.selenium.htmlunit.HtmlUnitDriver。(HtmlUnitDriver.java:191)
位于org.openqa.selenium.htmlunit.HtmlUnitDriver.(HtmlUnitDriver.java:187)
位于geb.driver.namebasedriverfactory.getDriver(namebasedriverfactory.groovy:42)
在geb.driver.CachingDriverFactory$\u getDriver\u closure3.doCall(CachingDriverFactory.groovy:80)
在geb.driver.CachingDriverFactory$\u getDriver\u closure3.doCall(CachingDriverFactory.groovy)
在geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:30)
位于geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:79)
在geb.Configuration.createDriver处(Configuration.groovy:354)
位于geb.Configuration.getDriver(Configuration.groovy:343)
位于geb.Browser.getDriver(Browser.groovy:105)
在geb.Browser.go(Browser.groovy:394)
在geb.Browser$go$1.callCurrent(未知源)
在geb.Browser.go(Browser.groovy:386)
在gebtest$\u run\u closure1.doCall(gebtest.groovy:14)
在gebtest$\u run\u closure1.doCall(gebtest.groovy)
位于geb.Browser.drive(Browser.groovy:860)
在geb.Browser$drive$0.callStatic(未知源)
在geb.Browser.drive(Browser.groovy:830)
在geb.Browser$drive.call处(未知源)
运行(gebtest.groovy:13)
位于com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

我建议使用Gradle,这样可以避免手动设置项目和解决Geb依赖关系。使用gradle进行此操作的最简单方法是:

安装:
http://gvmtool.net/

通过gvm安装Gradle:
gvm安装Gradle 1.12

创建
build.gradle
文件:

apply plugin: 'idea'
apply plugin: 'groovy'

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.gebish:geb-core:0.9.3'
    compile 'org.codehaus.groovy:groovy-all:2.3.3'
    compile 'org.seleniumhq.selenium:selenium-firefox-driver:2.42.2'
}
创建一个
src/main/groovy
目录

运行
gradleidea

打开生成的idea项目文件


将Geb脚本放在
src/main/groovy
目录中并运行它。

这看起来像是的副本。我得到了同样的东西。有一个在jdk中,一个在xml-API-1.4.01.jar中,从htmlunit加载。是的,类似的问题我将xml-API-1.4.01.jar添加到了认可的目录中。然后我得到SAXParserFactoryImpl未找到。去做别的事情。