grails升级2.4.0导致错误编译错误:启动失败

时间:2014-05-28 15:10:38

标签: grails upgrade

我正在尝试从Grails 2.2.3升级到Grails 2.4.0。为此我遵循了以下步骤:

  1. 使用GVM,我已经安装了grails 2.4.0
  2. 将grails默认版本设置为2.4.0
  3. 然后在我的项目目录中运行命令set-grails-version到2.4.0 和 然后更新java以使用oracle jdk 7
  4. 我收到以下错误。有什么建议吗?

    Error Compilation error: startup failed:
    /home/madan/.grails/2.4.0/projects/mainthub/plugins/mail-1.0/src/groovy/grails/plugin/mail/MailMessageContentRenderer.groovy: 21: unable to resolve class org.codehaus.groovy.grails.plugins.PluginManagerHolder
     @ line 21, column 1.
       import org.codehaus.groovy.grails.plugins.PluginManagerHolder
       ^
    
    /home/madan/.grails/2.4.0/projects/mainthub/plugins/resources-1.2/grails-app/taglib/org/grails/plugin/resource/ResourceTagLib.groovy: 6: unable to resolve class org.codehaus.groovy.grails.commons.ConfigurationHolder
     @ line 6, column 1.
       import org.codehaus.groovy.grails.commons.ConfigurationHolder
       ^
    
    /home/madan/.grails/2.4.0/projects/mainthub/plugins/resources-1.2/src/groovy/org/grails/plugin/resource/ResourceProcessor.groovy: 6: unable to resolve class org.codehaus.groovy.grails.plugins.PluginManagerHolder
     @ line 6, column 1.
       import org.codehaus.groovy.grails.plugins.PluginManagerHolder
       ^
    
    /home/madan/.grails/2.4.0/projects/mainthub/plugins/resources-1.2/src/groovy/org/grails/plugin/resource/util/HalfBakedLegacyLinkGenerator.groovy: 3: unable to resolve class org.codehaus.groovy.grails.commons.ConfigurationHolder
     @ line 3, column 1.
       import org.codehaus.groovy.grails.commons.ConfigurationHolder
       ^
    
    /home/madan/.grails/2.4.0/projects/mainthub/plugins/joda-time-1.4/grails-app/taglib/grails/plugin/jodatime/taglib/PeriodTagLib.groovy: 18: unable to resolve class org.codehaus.groovy.grails.commons.ConfigurationHolder
     @ line 18, column 1.
       import org.codehaus.groovy.grails.commons.ConfigurationHolder
       ^
    
    /home/madan/.grails/2.4.0/projects/mainthub/plugins/email-confirmation-2.0.8/grails-app/services/com/grailsrocks/emailconfirmation/EmailConfirmationService.groovy: 24: unable to resolve class org.codehaus.groovy.grails.commons.ConfigurationHolder
     @ line 24, column 1.
       import org.codehaus.groovy.grails.commons.ConfigurationHolder
       ^
    
    /home/madan/.grails/2.4.0/projects/mainthub/plugins/email-confirmation-2.0.8/grails-app/services/com/grailsrocks/emailconfirmation/EmailConfirmationService.groovy: 25: unable to resolve class org.codehaus.groovy.grails.commons.ApplicationHolder
     @ line 25, column 1.
       import org.codehaus.groovy.grails.commons.ApplicationHolder
       ^
    
    /home/madan/.grails/2.4.0/projects/mainthub/plugins/quartz-1.0-RC2/grails-app/conf/QuartzBootStrap.groovy: 18: unable to resolve class org.codehaus.groovy.grails.commons.ConfigurationHolder
     @ line 18, column 1.
       import org.codehaus.groovy.grails.commons.ConfigurationHolder
       ^
    
    /home/madan/.grails/2.4.0/projects/mainthub/plugins/quartz-1.0-RC2/grails-app/conf/QuartzBootStrap.groovy: 31: unable to resolve class org.codehaus.groovy.grails.commons.ConfigurationHolder 
     @ line 31, column 12.
               if(ConfigurationHolder.config?.quartz?.autoStartup) quartzScheduler.start()
                  ^
    
    /home/madan/.grails/2.4.0/projects/mainthub/plugins/joda-time-1.4/src/groovy/grails/plugin/jodatime/binding/DateTimeEditor.groovy: 20: unable to resolve class org.codehaus.groovy.grails.commons.ConfigurationHolder
     @ line 20, column 1.
       import org.codehaus.groovy.grails.commons.ConfigurationHolder
       ^
    
    /home/madan/.grails/2.4.0/projects/mainthub/plugins/joda-time-1.4/src/groovy/grails/plugin/jodatime/binding/DateTimeEditor.groovy: 30: unable to resolve class org.codehaus.groovy.grails.commons.ConfigurationHolder 
     @ line 30, column 38.
        @Lazy private ConfigObject config = ConfigurationHolder.config?.jodatime?.format
                                            ^
    
    11 errors
    

3 个答案:

答案 0 :(得分:15)

来自Grails 2.4.0的持有者类have been removed。更新到最新的插件版本应解决上面的编译错误。

如果您发现最新的插件版本不支持Grails 2.4.0,那么您只需要等到他们发布兼容2.4.0的版本才能升级。< / p>

根据个人经验,我知道以下插件具有2.4.0兼容版本:

  • 资源
  • 邮件
  • 石英

但我不确定电子邮件确认或joda-time

答案 1 :(得分:12)

以下已弃用的类已从Grails 2.4.x中删除:

org.codehaus.groovy.grails.commons.ApplicationHolder
org.codehaus.groovy.grails.commons.ConfigurationHolder
org.codehaus.groovy.grails.plugins.PluginManagerHolder
org.codehaus.groovy.grails.web.context.ServletContextHolder
org.codehaus.groovy.grails.compiler.support.GrailsResourceLoaderHolder

如果您或您安装的任何插件正在使用这些类,您将收到编译错误。可以通过更新到新插件并使用 grails.util.Holders 来解决此问题。

例如

application = org.codehaus.groovy.grails.commons.ApplicationHolder.application 

application = Holders.grailsApplication

答案 2 :(得分:3)

我认为&#34;:quartz:1.0.1&#34;和&#34;:资源:1.2.8&#34;是2.4兼容。据我所知,你遇到的其他插件还没有2.4兼容版本。 2.4并没有很长时间,插件作者仍在努力更新他们的代码。