0

我想为我的 Grails 项目使用 Spock 插件。我遇到的问题是 GGTS 没有配置构建路径。所以我可以在 GGTS 中生成以下集成测试,但它会抱怨找不到 grails.plugin.spock.IntegrationSpec 包。

package junk

import grails.plugin.spock.IntegrationSpec

class MyIntegrationTestSpec extends IntegrationSpec {
    def setup() {
    }

    def cleanup() {
    }

    void "test something"() {
    }
}

我已经使用了 Grails 插件管理器并编辑了 BuildConfig.groovy 文件(就像插件文档所说的那样)。我已经对我的项目完成了 Grails Refresh Dependencies。我什至做了 grails clean 和 grails compile。似乎没有任何效果。

4

1 回答 1

0

Spock 插件页面解释了如何配置你的BuildConfig.groovy

grails.project.dependency.resolution = {
  repositories {
    grailsCentral()
    mavenCentral()
  }
  dependencies {
    test "org.spockframework:spock-grails-support:0.7-groovy-2.0"
  }
  plugins {
    test(":spock:0.7") {
      exclude "spock-grails-support"
    }
  }
}

之后,您需要运行:

grails compile --refresh-dependencies

或在 STS 中:

right click in the project > grails tools > refresh dependencies
于 2013-11-13T01:03:50.380 回答