无法安装spock到grails 1.3.7项目

时间:2012-07-31 12:40:25

标签: grails grails-plugin spock

我使用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并注意到有一个版本0.6-groovy-1.7的spock。所以我试过了:

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]

的插件

有什么想法吗?

2 个答案:

答案 0 :(得分:1)

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

grails install-plugin spock 0.6-groovy-1.7

答案 1 :(得分:1)

您是否尝试过使用plugin page?上的依赖关系解析安装说明 在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"
    }
  }
}