将Grails应用程序从1.3.7升级到2.4.1

时间:2014-06-26 18:01:10

标签: spring grails spring-security

我正试图在不重新学习Grails的情况下实现巨大飞跃。我有一个网站,我正在尝试从Grails 1.3.7升级到Grails 2.4.1。

有趣的是,一旦我将Grails版本设置为2.4.1,就会发生以下情况,

| Installed plugin database-migration-1.4.0.....
> You currently already have a version of the plugin installed [jquery-1.6.1.1]. Do you want to upgrade to [jquery-1.11.1]? [y,n] y
| Installed plugin jquery-1.11.1.....
> You currently already have a version of the plugin installed [tomcat-1.3.7]. Do you want to upgrade to [tomcat-7.0.54]? [y,n] y
| Uninstalled plugin [yui]
| Uninstalled plugin [spring-security-core]
| Uninstalled plugin [searchable]
| Uninstalled plugin [rendering]
| Uninstalled plugin [recaptcha]
| Uninstalled plugin [quartz]
| Uninstalled plugin [mail]
| Uninstalled plugin [jquery-ui]
| Uninstalled plugin [hibernate]
| Uninstalled plugin [google-analytics]| Uninstalled plugin [famfamfam]
| Uninstalled plugin [email-confirmation]
| Uninstalled plugin [cloud-foundry]
| Compiling 131 source files

卸载了大量插件。挖掘出来的是一组新的BuildConfig插件参数。我天真地添加了核心Spring安全插件,如下所示,

plugins {
    // plugins for the build system only
    build ":tomcat:7.0.54"

    // plugins for the compile step
    compile ":scaffolding:2.1.1"
    compile ':cache:1.1.6'
    compile ":asset-pipeline:1.8.11"
    compile ":spring-security-core:2.0-SNAPSHOT"

    // plugins needed at runtime but not for compilation
    runtime ":hibernate4:4.3.5.4" // or ":hibernate:3.6.10.16"
    runtime ":database-migration:1.4.0"
    runtime ":jquery:1.11.1"

    // Uncomment these to enable additional asset-pipeline capabilities
    //compile ":sass-asset-pipeline:1.7.4"
    //compile ":less-asset-pipeline:1.7.0"
    //compile ":coffee-asset-pipeline:1.7.0"
    //compile ":handlebars-asset-pipeline:1.3.0.3"
}

现在看来插件已经安装,我现在看到以下提示:

*******************************************************
* You've installed the Spring Security Core plugin.   *
*                                                     *
* Next run the "s2-quickstart" script to initialize   *
* Spring Security and create your domain classes.     *
*                                                     *
*******************************************************

但是,我仍然看到以下编译错误:

| Compiling 47 source files
  [groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
  [groovyc]     /Users/myusername/Development/protocols/src/groovy/com/mycompany/web/protocols/UserProfileDetails.groovy: 3: unable to resolve class org.codehaus.groovy.grails.plugins.springsecurity.GrailsUser
  [groovyc]  @ line 3, column 1.
  [groovyc]    import org.codehaus.groovy.grails.plugins.springsecurity.GrailsUser
  [groovyc]    ^
  [groovyc] 
  [groovyc] /Users/myusername/Development/protocols/src/groovy/com/mycompany/web/protocols/UserProfileUtils.groovy: 3: unable to resolve class         org.codehaus.groovy.grails.plugins.springsecurity.GormUserDetailsService
  [groovyc]  @ line 3, column 1.
  [groovyc]    import org.codehaus.groovy.grails.plugins.springsecurity.GormUserDetailsService
  [groovyc]    ^
  [groovyc] 
  [groovyc] /Users/myusername/Development/protocols/grails-app/controllers/LoginController.groovy: 5: unable to resolve class org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils
  [groovyc]  @ line 5, column 1.
  [groovyc]    import org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils
  [groovyc]    ^

我已经阅读了Grails 2.0及更高版本的发行说明,但我仍然在寻找我应该开始学习如何解开升级应用程序插件的确切点。

1 个答案:

答案 0 :(得分:7)

看起来我正在过度思考这个问题。它现在看起来像命名空间更改一样简单。 Spring安全核心插件类不再具有前缀的包名称,

org.codehaus.groovy.grails.plugins.springsecurity    

他们已经转移到新的根包名称

grails.plugin.springsecurity