Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Groovy/Grails - Unable to Resolve Class

I am trying to build a Grails project in STS and am getting many error messages of the form: Groovy:unable to resolve class org.codehaus.groovy.grails.commons.ConfigurationHolder as well as others like Groovy:unable to resolve class org.grails.plugins.springsecurity.service.AuthenticateService . I have Grails 1.3.7 selected in the Project Properties, but I don't see an item for 'Grails Depedencies' like I do when I create a sample project. Is this the problem? How can I add it back in?

like image 815
skaz Avatar asked May 29 '11 13:05

skaz


3 Answers

I don't know why, but here are the steps I took to solve the problem:

  1. Right click on the project and go to Grails Tools -> Enable Dependency Management
  2. Grails Tools -> Refresh Dependencies. This correctly added the 'Grails Dependencies' library.
  3. I still had plugin errors. I for some reason had to uninstall them and then reinstall them for the project to realize they were there.
like image 111
skaz Avatar answered Oct 13 '22 00:10

skaz


For anyone who is using Grails >= 2.4

If you are using Grails 2.4 and above, use grails.util.Holders instead of org.codehaus.groovy.grails.commons.ConfigurationHolder.

Read the doc here section 'Static Holder'

Classes The following deprecated classes have been removed from 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 If you or any plugins you have installed are using these classes you will get a compilation error. The problem can be rectified by updating to new plugins and using grails.util.Holders instead.

like image 35
biniam Avatar answered Oct 12 '22 23:10

biniam


If "Refresh Dependencies" has done all it can for you (as you indicate in your comment on the question), try disabling and re-enabling dependencies. You might try refreshing dependencies again afterward if the Acegi plugin still isn't recognized.

like image 38
Jim Norman Avatar answered Oct 12 '22 23:10

Jim Norman