我想在我的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编译。似乎没什么用。
答案 0 :(得分:0)
Spock plugin page说明了如何配置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