Grails ---违反装载机约束 [英] Grails --- loader constraint violation

查看:108
本文介绍了Grails ---违反装载机约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序之一中,我必须将geb与grails一起使用.我安装了geb插件并添加了依赖硒独立jar.

In one of my application i have to use geb with grails. i installed geb plugin and added dependency selenium standalone jar.

现在的问题是我在清理或编译时遇到如下错误

Now the problem is while i cleaning or compiling i got the error like following

退出交互模式并出现错误:违反了加载器约束:在解决重写的方法"org.apache.xerces.jaxp.SAXParserImpl.getXMLReader()Lorg/xml/sax/XMLReader;"时,当前类org/apache/xerces/jaxp/SAXParserImpl,的类加载器(instance of org/codehaus/groovy/grails/cli/support/GrailsRootLoader)及其超类加载器(instance of <bootloader>)具有不同的Class对象.签名中使用的org/xml/sax/XMLReader类型(使用--stacktrace查看完整跟踪)

Interactive mode exited with error: loader constraint violation: when resolving overridden method "org.apache.xerces.jaxp.SAXParserImpl.getXMLReader()Lorg/xml/sax/XMLReader;" the class loader (instance of org/codehaus/groovy/grails/cli/support/GrailsRootLoader) of the current class, org/apache/xerces/jaxp/SAXParserImpl, and its superclass loader (instance of <bootloader>), have different Class objects for the type org/xml/sax/XMLReader used in the signature (Use --stacktrace to see the full trace)

推荐答案

在您的BuildConfig.groovy中排除Selenium对xml-apis的传递依赖性:

Exclude the transitive dependency of Selenium to xml-apis like this in your BuildConfig.groovy:

dependencies {
    test("org.seleniumhq.selenium:selenium-htmlunit-driver:$seleniumVersion") {
        exclude "xml-apis"
    }
    test "org.codehaus.geb:geb-spock:$gebVersion"
    test "org.codehaus.geb:geb-junit4:$gebVersion"
}

请参见此示例项目有关更多详细信息.

See this example project for more details.

这篇关于Grails ---违反装载机约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆