简体   繁体   中英

Upgrading a Grails app from 1.3.7 to 2.4.1

I'm trying to make a huge leap without re-learning Grails. I have a web site that I'm trying to upgrade from Grails 1.3.7 to Grails 2.4.1.

Interestingly once I set the Grails version to 2.4.1 the following happened,

| 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

A whole host of plugins were uninstalled. Digging around revealed a new set of BuildConfig plugin parameters. I naively added the core Spring security plugin as follows,

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"
}

It appears the plugin installed as I now see the following prompt:

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

However, I still see the following compilation errors:

| 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]    ^

I've been through the release notes for Grails 2.0 and later but I'm still looking for the exact point at which I should start learning how to unravel upgrading my app's plugins.

It looks like I was overthinking this. It now appears to be as simple as a namespace change. The spring security core plugin classes are no longer have package names prefaced,

org.codehaus.groovy.grails.plugins.springsecurity    

they have moved to a new root package name,

grails.plugin.springsecurity

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