首页 > 解决方案 > Geb-core 3.2 与 groovy 2.5.8 冲突

问题描述

我尝试将最后一个 groovy 2.5.8 与 geb-core 3.2 一起使用。

例如

@Grapes([
        @Grab("org.gebish:geb-core:3.2"),
        @Grab("org.seleniumhq.selenium:selenium-firefox-driver:3.141.59"),
        @Grab("org.seleniumhq.selenium:selenium-support:3.141.59")
])
import geb.Browser
browser = new Browser()
println "Hello from test"

它是生成错误

C:\PROJ\bitb\checkBoard\test>groovy runTest.groovy org.codehaus.groovy.control.MultipleCompilationErrorsException:启动失败:转换期间出现一般错误:模块版本冲突。模块 [groovy-xml 在 2.5.8 版本中加载,您正在尝试加载 2.5.6 版本

如果我将 geb-core 更改为 2.3.1 它运行良好。也许我应该改变一些配置?

提前致谢!

标签: groovygeb

解决方案


Geb 依赖于 Groovy,但在运行脚本时您已经加载了 Groovy - 您需要获取排除 Groovy 模块:

@Grapes([
        @Grab("org.gebish:geb-core:3.2"),
        @Grab("org.seleniumhq.selenium:selenium-firefox-driver:3.141.59"),
        @Grab("org.seleniumhq.selenium:selenium-support:3.141.59"),
        @GrabExclude("org.codehaus.groovy:groovy-all")
])

推荐阅读