3

我使用 Grails 1.3.7 创建了一个简单的 hello world grails 应用程序:

grails create-app hello
grails create-controller hello

然后我尝试使用以下方法安装 spock 插件:

grails install-plugin spock

我得到以下信息:

Error loading event script from file [/Users/wholladay/.grails/1.3.7/projects/hello/plugins/spock-0.6/scripts/_Events.groovy] startup failed:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/Users/wholladay/.ivy2/cache/org.spockframework/spock-core/jars/spock-core-0.6-groovy-1.8.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation  because of exception org.spockframework.util.IncompatibleGroovyVersionException: The Spock compiler plugin cannot execute because Spock 0.6.0-groovy-1.8 is not compatible with Groovy 1.7.8. For more information, see http://versioninfo.spockframework.org
Spock location: file:/Users/wholladay/.ivy2/cache/org.spockframework/spock-core/jars/spock-core-0.6-groovy-1.8.jar
Groovy location: file:/usr/local/Cellar/grails/current/lib/groovy-all-1.7.8.jar

所以我去了:http: //versioninfo.spockframework.org并注意到 spock 有一个 0.6-groovy-1.7 版本。所以我尝试了:

grails install-plugin spock 0.6-groovy-1.7

但后来我收到以下错误:

Error resolving plugin [name:spock, group:org.grails.plugins, version:0.6-groovy-1.7].

未找到名称 [spock] 和版本 [0.6-groovy-1.7] 的插件

有任何想法吗?

4

2 回答 2

1

我认为你犯了一个简单的错误。你想要的是:

grails install-plugin spock 0.6-groovy-1.7
于 2012-07-31T12:43:43.400 回答
1

您是否尝试过使用插件页面上的依赖解析安装说明? 在您的 BuildConfig.groovy 中:

grails.project.dependency.resolution = {
  repositories {
    grailsCentral()
    mavenCentral()
  }
  dependencies {
    test "org.spockframework:spock-grails-support:0.6-groovy-1.7"
  }
  plugins {
    test(":spock:0.6") {
      exclude "spock-grails-support"
    }
  }
}
于 2012-08-01T03:04:08.340 回答