简体   繁体   中英

Error in eclipse project grails/groovy

I have the following error when working with grails project in eclipse

An internal error occurred during: "Requesting Java AST from selection". org.codehaus.groovy.eclipse.core.compiler.GroovySnippetCompiler.(Lorg/codehaus/groovy/eclipse/core/model/GroovyProjectFacade;)V

Anybody have the same problem?

How fix the problem?

Update :

The issue was fixed in the latest Snapshot releases of Groovy Eclipse 2.9.3 so you may now just follow the guide @ https://technology.first8.nl/eclipse-neon-grails-2-x-with-groovy-and-gsp-support/

Previous answer :

I also stumbled across this error and it happens only in classes that are grails-artefacts (services, controllers, ...). It seems to be related to recent changes in grails-eclipse plugin 2.9.2. A version from june 2017 worked without any issues and a recent upgrade to 2.9.2 release from january 2018 brought up the issue.

I fixed the issue by using the groovy-eclipse 2.9.2 version from 2015 which is contained in the GGTS update-site zip ( http://download.springsource.com/release/TOOLS/update/3.6.4.RELEASE/e4.5/springsource-tool-suite-3.6.4.RELEASE-e4.5-updatesite.zip ).

What I was searching for (without success) was an archive of release versions of the groovy-eclipse 2.9.2 branch. This way I would at least have the option to install the working 2.9.2 version from june 2017... If anyone has a clue where to find older versions I would be happy for a hint!

The stacktrace of the initially mentioned Exception looks like that:

java.lang.NoSuchMethodError: org.codehaus.groovy.eclipse.core.compiler.GroovySnippetCompiler.<init>(Lorg/codehaus/groovy/eclipse/core/model/GroovyProjectFacade;)V
    at org.grails.ide.eclipse.editor.groovy.types.PerProjectTypeCache.setProject(PerProjectTypeCache.java:107)
    at org.grails.ide.eclipse.core.internal.plugins.GrailsCore$PerProjectCacheManager.get(GrailsCore.java:54)
    at org.grails.ide.eclipse.core.internal.plugins.GrailsCore.connect(GrailsCore.java:199)
    at org.grails.ide.eclipse.editor.groovy.elements.GrailsProject.findAllServices(GrailsProject.java:510)
    at org.grails.ide.eclipse.editor.groovy.types.PerProjectServiceCache.ensureInitialized(PerProjectServiceCache.java:108)
    at org.grails.ide.eclipse.editor.groovy.types.PerProjectServiceCache.findServicesFor(PerProjectServiceCache.java:93)
    at org.grails.ide.eclipse.editor.groovy.elements.AbstractGrailsElement.populateInjectedServices(AbstractGrailsElement.java:148)
    at org.grails.ide.eclipse.editor.groovy.elements.ControllerClass.initializeTypeLookup(ControllerClass.java:284)
    at org.grails.ide.eclipse.editor.groovy.types.GrailsTypeLookup.initialize(GrailsTypeLookup.java:100)
    at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitCompilationUnit(TypeInferencingVisitorWithRequestor.java:347)
    at org.codehaus.groovy.eclipse.codebrowsing.requestor.CodeSelectHelper.selectASTNode(CodeSelectHelper.java:126)
    at org.codehaus.groovy.eclipse.search.GroovyOccurrencesFinder.initialize(GroovyOccurrencesFinder.java:181)
    at org.codehaus.groovy.eclipse.search.GroovyOccurrencesFinder.findOccurrences(GroovyOccurrencesFinder.java:209)
    at org.codehaus.groovy.eclipse.editor.GroovyEditor.updateOccurrenceAnnotations(GroovyEditor.java:1317)
    at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor$6.selectionChanged(JavaEditor.java:3380)
    at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:178)
    at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup$3.run(SelectionListenerWithASTManager.java:155)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

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