Grails 2.0.4/2.1.1 test-app throws ClassNotFoundException (G



我有一个旧的grails应用程序,我最近从1.3.7升级到> 2.0.4在我将它升级到2.1.1

之后,同样的事情发生了。

当我尝试从GGTS运行测试应用程序时,我得到:

| Error Error executing script TestApp: java.lang.ClassNotFoundException: grails.plugin.spock.test.GrailsSpecTestType (Use --stacktrace to see the full trace)

SS网站4月份也有类似的报告。

我还看到有很多关于grails 1.3.7的类似异常的问题——然而,这是一个影响2.0.4的问题。

编辑:好吧,它实际上也发生在命令行,但至少我可以让它工作。不幸的是,重启后它又坏了。

这是我在控制台修复它的方法,基本上我升级到0.7,降级到0.5-groovy-1.7

grails> clean
| Application cleaned.
grails> refresh-dependencies
| Dependencies refreshed.
grails> test-app
| Compiling 73 source files
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
| Compiling 119 source files
| Compiling 119 source files.
| Error Error running script test-app : java.lang.ClassNotFoundException: grails.plugin.spock.test.GrailsSpecTestType (U
se --stacktrace to see the full trace)
grails> install-plugin spock
| Resolving plugin spock. Please wait...
> You currently already have a version of the plugin installed [spock-0.5-groovy-1.7]. Do you want to update to [spock-0
.7]? [y,n] y
| Plugin installed.
grails> clean
| Application cleaned.
grails> refresh-dependencies
| Application cleaned.....
> You currently already have a version of the plugin installed [spock-0.7]. Do you want to update to [spock-0.5-groovy-1
.7]? [y,n] n
| Dependencies refreshed.
grails> test-app
> You currently already have a version of the plugin installed [spock-0.7]. Do you want to update to [spock-0.5-groovy-1
.7]? [y,n] n
| Compiling 73 source files
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
| Compiling 119 source files
| Compiling 119 source files.
| Error Error running script test-app : java.lang.ClassNotFoundException: grails.plugin.spock.test.GrailsSpecTestType (U
se --stacktrace to see the full trace)
grails> install-plugin spock
| Plugin 'spock' with version '0.7' is already installed
| Plugin not installed.
grails> uninstall-plugin spock
| Uninstalled plugin [spock]
grails> clean
| Application cleaned.
grails> refresh-dependencies
| Dependencies refreshed.
grails> test-app
| Compiling 73 source files
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
| Compiling 119 source files    
| Running 8 unit tests... 5 of 8

所以这显然是由于一些行为不当的插件导出它的spock依赖。如果您的麻烦制造者是GWT,则示例解决方案:

compile(':gwt:0.8') {
exclude 'spock'
}

感谢Nathan Dunn

最新更新