7

I am trying to use the ":spring-security-core:2.0-RC2" (using Grails version 2.3.1), but have my own LoginController.groovy. Following Burt's notes (here and here), I copied the LoginController.groovy from the original location at "myapp\target\work\plugins\spring-security-core-2.0-RC2\grails-app\controllers\grails\plugin\springsecurity" to my project location at "myapp\grails-app\controllers\com\company". Now I get a bunch of import error messages like "Groovy:unable to resolve class ..." (I have attached am image below showing all the imports giving errors). How do I take care of these errors?

Sorry if this is a trivial question (still getting used to Grails), and thank you for the help!

enter image description here

Community
  • 1
  • 1
tikka
  • 493
  • 1
  • 4
  • 17

1 Answers1

11

It looks like GGTS/STS isn't entirely aware that the plugin is installed, since those classes are from the two jars that the plugin depends on. Try right-clicking the project node in the tree and running Grails Tools > Refresh Dependencies. If that's not enough, run Project | Clean to force a full recompile.

Burt Beckwith
  • 75,342
  • 5
  • 143
  • 156
  • 5
    Thank you, Burt! The "Refresh Dependencies" helped. After doing that when I tried to run I got an error saying `No such property: SpringSecurityUtils`. Then after digging some more ([link](http://stackoverflow.com/questions/19624919/grails-openid-plugin-2-0-0-rc1-getting-no-such-property-user-exception)) I included `import grails.plugin.springsecurity.SpringSecurityUtils` and now it works as expected. (Note: `import org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils` did NOT seem to work). – tikka Feb 01 '14 at 20:13
  • 1
    The original class is in the same package so it doesn't need to import `SpringSecurityUtils`, but you will need to for your class. The other import is the old one from the 1.2.x plugin – Burt Beckwith Feb 01 '14 at 20:16
  • @BurtBeckwith do you have any idea about this issue? http://stackoverflow.com/questions/37547047/suddenly-grails-ggts-is-unable-to-resolve-many-classes-how-to-solve-it Am I following your recommendations? – victorf May 31 '16 at 14:51