开发者

Groovy/Grails - Unable to Resolve Class

开发者 https://www.devze.com 2023-03-08 21:28 出处:网络
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 lik

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.Auth开发者_JAVA技巧enticateService . 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?


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.


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.


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号