2014-07-08 189 views
0

每次尝试创建Grails项目时,都会收到以下错误消息。我可以从终端创建项目,但不能从IDE创建项目。我正在使用GGTS,我是新来的Grails。命令以异常终止

Command terminated with an exception: java.lang.Exception (see details for partial output) Command: GrailsCommand(P/BookSolution> compile --non-interactive --refresh-dependencies) ---- System.out ---- Loading Grails 2.3.8 . |Environment set to development .......... |Compiling 78 source files .Error | Compilation error: startup failed: C:\grails\BookSolution\target\work\plugins\database-migration-1.4.0\grails-app\controllers\grails\plugin\databasemigration\DbdocController.groovy: -1: Repetitive method name/signature for method 'java.lang.Object withFormat(groovy.lang.Closure)' in class 'grails.plugin.databasemigration.DbdocController'. @ line -1, column -1. C:\grails\BookSolution\target\work\plugins\database-migration-1.4.0\grails-app\controllers\grails\plugin\databasemigration\DbdocController.groovy: -1: Repetitive method name/signature for method 'java.lang.Object withFormat(groovy.lang.Closure)' in class 'grails.plugin.databasemigration.DbdocController'. @ line -1, column -1. 2 errors Error | org.codehaus.groovy.grails.cli.ScriptExitException Error | at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) Error | at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) Error | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) Error | at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ... 68 more ------System.err:-----------

+2

错误与数据库迁移-1.4.0有关 - 我可以确认是grails 2.4的一部分,在IDE中,此插件默认添加到BuildConfig中,至今没有给我任何问题...尝试将其注释掉?刷新依赖? – Vahid

+0

我不认为这个错误真的与数据库迁移有关。我预计所有控制器都会出现问题。请参阅下面的答案。 –

+0

谢谢杰夫 - 甚至没有下降1.8路线:) – Vahid

回答

2

它看起来像你使用的是Java 8 Grails的2.3.8不支持Java 8.如果要使用Java 8,你需要升级到Grails的2.4。截至目前,该发布链中的最新版本是2.4.2。

+0

是的,我使用Java 8.我更新到Grails 2.4.2,现在错误消失了。但是新的错误出现了。构建期间发生错误。 在项目'BookSolution'上运行构建器'Java Builder'的错误。 org.codehaus.groovy.runtime.DefaultGroovyMethods.count(Ljava/lang/Iterable; Lgroovy/lang/Closure;)Ljava/lang/Number ;.这是什么意思? – budthapa

+0

没有看到代码就很难说。首先猜测是您的项目中有与其他版本的Grails和Groovy一起编译的代码。做一个完整的清洁和/或发现,如果你可以重现一个干净的项目的问题。如果问题仍然存在,请在此单独提出一个问题,以免在寻找“接受方法”或类似方法时发现该问题的人员混淆此问题。我认为这个解决方案现在已经解决了。 –

+0

找到了构建错误的解决方案。这是由于编译器不匹配。谢谢大家的时间。 – budthapa