skaz
skaz

Reputation: 22580

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?

Upvotes: 8

Views: 45745

Answers (5)

nshweta
nshweta

Reputation: 509

I faced a similar issue: "Unable to resolve class GrailsTestCase". I checked Grails Tools of my project and observed Dependency Management was already enabled (IDE - GGTS). I just disabled Dependency Management, refreshed and enabled it again. This solved the issue for me.

Upvotes: 0

biniam
biniam

Reputation: 8199

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.

Upvotes: 7

SShehab
SShehab

Reputation: 1051

there is another way solved me this issue when i moved my workspace from Windows OS to Ubuntu , go to

yourWorkSpace -->yourGrailsProject-->setting folder --> org.grails.ide.eclipse.core.prefs, 

then check all the grails paths are correct or not , because in my case all were pointing to windows paths ..

Hope this solve.

Upvotes: 0

Jim Norman
Jim Norman

Reputation: 749

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.

Upvotes: 2

skaz
skaz

Reputation: 22580

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.

Upvotes: 20

Related Questions