【问题标题】:Grails - Spock - excution failed for task ':test' - GradleGrails - Spock - 任务':test'的执行失败 - Gradle
【发布时间】:2018-07-25 16:15:39
【问题描述】:

我在 Spock 中使用 Grails + groovy。在我安装 Spock 并开始编写单元测试之前,该应用程序构建良好。

JVM 版本 - 1.8.0_171***Grails 版本 - 3.3.6***Groovy 版本 - 2.4.15

依赖 -

testCompile "org.grails:grails-gorm-testing-support"
testCompile "org.grails:grails-web-testing-support"
testCompile "org.grails.plugins:geb:1.1.2"
testCompile "org.spockframework:spock-core:1.1-groovy-2.4-rc-2"
testCompile "org.grails:grails-test-mixins:3.3.0.RC1"  

我也在 IntelliJ(ultimate) 中尝试了“清理”和“使缓存无效/重新启动”。

Build failed with an exception

Initialization Error

unit test code

【问题讨论】:

    标签: java gradle grails spock


    【解决方案1】:

    对我来说似乎是版本问题。另外,使用ControllerUnitTest trait 而不是 test mixin。因此,首先从 build.gradle 中删除这些行。

    testCompile "org.spockframework:spock-core:1.1-groovy-2.4-rc-2"
    testCompile "org.grails:grails-test-mixins:3.3.0.RC1"  
    

    然后更新测试以实现ControllerUnitTest trait。 Here 就是一个例子。

    您还应该检查documentation

    【讨论】:

    • 我删除了 spock 框架依赖,它现在构建良好。谢谢!
    猜你喜欢
    • 2013-07-09
    • 1970-01-01
    • 1970-01-01
    • 2013-12-08
    • 1970-01-01
    • 2021-08-07
    • 2021-08-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多