How do I upgrade the Grails version for an existing application?

让人想犯罪 __ 提交于 2020-01-16 00:52:14

问题


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?


回答1:


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.




回答2:


I understood your problem. The solution is just modify the grails vesion to 1.2.0 in application.properties file in your application




回答3:


You can upgrade grails version with 5 steps

  1. Project -> Clean
  2. application.properties -> Change app.grails.version
  3. Your project -> Properties -> Grails -> Change grails installation to new grails version.
  4. Your project -> Grails tools -> Refresh Dependencies

I think this may be help you



来源:https://stackoverflow.com/questions/2034023/how-do-i-upgrade-the-grails-version-for-an-existing-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!