【发布时间】:2009-07-14 20:21:47
【问题描述】:
我正在用 Groovy 编写一个小型测试应用程序。我有以下代码。
class Address {
static constraints = {
street(blank:false, maxSize:100)
residencenumber(min:1, max:65000)
addition()
zip()
city(blank:false, maxSize:100)
county()
country(blank:false, maxSize:50)
}
String street
String zip
int residencenumber
String addition
String city
String county
String country
String toString() {
return street + " " + residencenumber + " " + zip + " " + city + " " + country
}
}
我收到了这条相当神秘的信息。
nojevive@follett:~/dev/code/mysmallapp$ grails generate-all 地址 欢迎使用 Grails 1.1.1 - http://grails.org/ 根据 Apache 标准许可证 2.0 获得许可 Grails home 设置为:/home/nojevive/dev/grails
基本目录:/home/nojevive/dev/code/mysmallapp
运行脚本 /home/nojevive/dev/grails/scripts/GenerateAll.groovy
环境设置为开发
groovy.lang.MissingMethodException: No signature of method: java.lang.Integer.call() is applicable for argument types: () values: []
at Project$__clinit__closure1.doCall(Project.groovy:11)
at Project$__clinit__closure1.doCall(Project.groovy)
at Project.getProperty(Project.groovy)
at _PluginDependencies_groovy$_run_closure6_closure53.doCall(_PluginDependencies_groovy:467)
at _PluginDependencies_groovy$_run_closure6_closure53.doCall(_PluginDependencies_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:274)
at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
at _PluginDependencies_groovy$_run_closure6.doCall(_PluginDependencies_groovy:447)
at _GrailsBootstrap_groovy$_run_closure1.doCall(_GrailsBootstrap_groovy:74)
at _GrailsGenerate_groovy$_run_closure1.doCall(_GrailsGenerate_groovy:37)
at GenerateAll$_run_closure1.doCall(GenerateAll.groovy:42)
at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:344)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:334)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.processTargets(Gant.groovy:495)
at gant.Gant.processTargets(Gant.groovy:480)
Error loading plugin manager: No signature of method: java.lang.Integer.call() is applicable for argument types: () values: []
首先我认为我的号码可能超出范围(我有 1000000)。然后我想也许这个号码是一个内置名称,所以我重命名为 Residencenumber。但没有运气。我在这里想念什么? 我现在删除了所有约束,但仍然是相同的消息。所以它与我猜的领域无关。一定是有什么东西坏了?
【问题讨论】:
-
我清理了项目并重新编译。得到同样的错误。原来在另一个班级有错字?怎么需要在命令行指定域类 generate-all 然后好像又编译了另一个类?好吧,也许初学者很挣扎......
-
我不久前参加了 Scott Davis 的 Grails 课程。我在课堂上学到的最重要的事情之一是,如果你遇到了一个非常奇怪且没有意义的错误,请对你的项目进行干净的重建。大约 90% 的时间有些东西不同步,只需要重新编译。
标签: groovy compiler-errors stack-trace