classpath container for Grails in STS

2019-07-05 05:10发布

问题:

I have a problem with STS on Grails Dependencies. There is one entry, which is pointing to wrong directory. Internal STS build fails due to an error:

Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".

  java.lang.NullPointerException
    at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNodeBuilder.toRawType(JDTClassNodeBuilder.java:116)
    at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNodeBuilder.configureParameterizedType(JDTClassNodeBuilder.java:290)
    at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNodeBuilder.configureType(JDTClassNodeBuilder.java:56)
    at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNodeBuilder.build(JDTClassNodeBuilder.java:46)
    at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.makeClassNode(JDTClassNode.java:399)
    at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.makeParameter(JDTClassNode.java:379)
    at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.makeParameters(JDTClassNode.java:366)
    at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.methodBindingToMethodNode(JDTClassNode.java:339)
    at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.initializeMembers(JDTClassNode.java:256)
    at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.initialize(JDTClassNode.java:227)
    at org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNode.lazyClassInit(JDTClassNode.java:158)
    at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:1087)
    at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:1079)
    at org.codehaus.groovy.ast.ClassNode.getSuperClass(ClassNode.java:1073)
    at org.codehaus.groovy.ast.ClassNode.isDerivedFrom(ClassNode.java:1013)
    at org.codehaus.groovy.classgen.ClassCompletionVerifier.visitCatchStatement(ClassCompletionVerifier.java:448)
    at org.codehaus.groovy.ast.stmt.CatchStatement.visit(CatchStatement.java:41)
    at org.codehaus.groovy.ast.CodeVisitorSupport.visitTryCatchFinally(CodeVisitorSupport.java:84)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitTryCatchFinally(ClassCodeVisitorSupport.java:244)
    at org.codehaus.groovy.ast.stmt.TryCatchStatement.visit(TryCatchStatement.java:42)
    at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:35)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:179)
    at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
    at org.codehaus.groovy.ast.CodeVisitorSupport.visitIfElse(CodeVisitorSupport.java:56)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitIfElse(ClassCodeVisitorSupport.java:219)
    at org.codehaus.groovy.ast.stmt.IfStatement.visit(IfStatement.java:41)
    at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:35)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:179)
    at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
    at org.codehaus.groovy.ast.CodeVisitorSupport.visitClosureExpression(CodeVisitorSupport.java:174)
    at org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:45)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitProperty(ClassCodeVisitorSupport.java:142)
    at org.codehaus.groovy.classgen.ClassCompletionVerifier.visitProperty(ClassCompletionVerifier.java:349)
    at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1160)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:51)
    at org.codehaus.groovy.classgen.ClassCompletionVerifier.visitClass(ClassCompletionVerifier.java:74)
    at org.codehaus.groovy.control.CompilationUnit$6.call(CompilationUnit.java:838)
    at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1152)
    at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:588)
    at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:566)
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:543)
    at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.processToPhase(GroovyCompilationUnitDeclaration.java:171)
    at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.generateCode(GroovyCompilationUnitDeclaration.java:1555)
    at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:838)
    at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:137)
    at java.lang.Thread.run(Unknown Source)

Grails command run-app works fine.

I got this entry by unwanted linking the plugin-classes to

C:\Documents and Settings\<myUserName>\.grails\1.3.7\projects\<ProjectName>\plugin-classes

And now I'm looking for a method to remove this entry, but under Project->Build Path-> Configure Build Path -> Libraries the remove button is disabled.

If I look inside .classpath file I see following entry:

<classpathentry kind="con" path="org.grails.ide.eclipse.core.CLASSPATH_CONTAINER"/>

Google about CLASSPATH_CONTAINER was unsuccessful. There is no changes in the files inside conf directory (diff with subversion)

I've already tried to do:

  1. delete .ivy2 folder
  2. delete .grails folder
  3. grails clean
  4. Grails-> refresh dependencies
  5. Project -> clean
  6. Delete Project and import the last version from SVN
  7. Delete Workspace and create fresh one
  8. any combination of 1..7

Please help!

回答1:

  1. delete .ivy2 folder
  2. delete .grails folder
  3. delete .m2 folder
  4. remove all added plugins from application.properties
  5. remove all added plugins from BuildConfig.groovy
  6. try to restart your project - should work now
  7. reinstall you plugins


回答2:

Following steps have solved my problem:

  1. delete .grails folder
  2. delete .ivy2 folder
  3. delete workspace
  4. reinstall eclipse (that was the missing step)
  5. List item
  6. import the project into new workspace
  7. make sure that grails and groovy compiler versions are not upgraded for this project.

I'm not sure which step can be obmitted. Ralf, thanks for suggestion.