我如何升级现有应用程序的Grails版本? [英] How do I upgrade the Grails version for an existing application?
问题描述
我现在正在加载一个Grails应用程序(来自Grails in Action),它是在不久前在1.1.1版本中创建的。 Grails 1.2.0并希望重新访问该应用程序。但是,当我尝试运行它时,我收到以下消息:
lockquote
应用程序需要grails版本[1.1.1],但GRAILS_HOME是版本[ 1.2.0] - 使用正确的Grails版本或运行'grails升级',如果这个Grails版本比你的应用程序期望的版本更新的话。
<在阅读了一段时间后,我清除了我的主目录下的.grails 1.2.0文件夹(从以前的尝试,同时探索问题),运行grails clean和grails upgrade(在出现提示时回答y) 。
然而,我一直在\grails\qotd\src\java和\grails\qotd中得到无效的重复类定义类之间的冲突\grails-app {controllers,services,conf}。
是否有任何额外的手动步骤需要执行?
如果您在两个位置拥有相同名称的文件/类,那可能是罪魁祸首。如果你在/ src / java中有.groovy文件,那是另一个潜在的来源。
另外,将BootStrap,Config,DataSource和URLMappings放入/ src / java中,这是另一个潜在的问题。我会清除你的/ src / java,确保所有文件都在grails-app下的适当位置。
I have an example Grails application (from Grails in Action) that was created a while ago under version 1.1.1 on a different PC.
I am now loading Grails 1.2.0 and want to revisit the app. However, when I try to run it I get this message:
Application expects grails version [1.1.1], but GRAILS_HOME is version [1.2.0] - use the correct Grails version or run 'grails upgrade' if this Grails version is newer than the version your application expects.
After reading around a bit I cleared out the 1.2.0 folder under .grails in my home directory (from previous attempts while exploring the issue), ran "grails clean" and "grails upgrade" (answering "y" where prompted).
However, I consistently get "Invalid duplicate class definition" conflicts between classes in \grails\qotd\src\java and \grails\qotd\grails-app{controllers,services,conf}.
Are there any additional manual steps that I need to perform?
If, as you pointed out in the comments, your /src/java contains .groovy files - that could definitely cause unexpected behavior. I haven't hit your particular issue, but any time I had a .groovy file mismatched with the class name inside it, I'd get strange compilation issues - so I guess you could be having a similar issue.
If you have files / classes with the same names in two locations, that's the likely culprit. If you have .groovy files in /src/java, that's another potential source.
Also, putting BootStrap, Config, DataSource and URLMappings into /src/java, that's another potential source of issues. I'd clear out your /src/java by making sure all the files are in their appropriate places under grails-app.
这篇关于我如何升级现有应用程序的Grails版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!