2012-07-31 60 views
3

我創建使用Grails 1.3.7一個簡單的Hello World的Grails應用程序:無法安裝到斯波克的Grails 1.3.7項目

grails create-app hello 
grails create-controller hello 

然後我嘗試使用安裝斯波克插件:

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- Spock 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]. 

插件沒有發現名稱[斯波克]和版本[0.6 Groovy的1.7

任何想法?

回答

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" 
    } 
    } 
} 
+0

哇!我所要做的只是閱讀文檔?!這真是太棒了,謝謝你將這引起我的注意。它像一個魅力。 – wholladay 2012-08-01 18:19:46

1

我認爲你犯了一個簡單的錯誤。你想要的是:

grails install-plugin spock 0.6-groovy-1.7 
+0

是的,我也做一個印刷工第二次我想這。不過,我只是用「spock」​​重新嘗試過,得到了同樣的結果。我更新了我的問題以反映這一點。 – wholladay 2012-07-31 14:49:19