简体   繁体   中英

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

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?

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM