GRECLIPSE
  1. GRECLIPSE
  2. GRECLIPSE-1095

Eclipse freezes when compiling grails BuildConfig.groovy containing @Grab annotations

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 2.1.0Release, 2.5.0Release
    • Fix Version/s: None
    • Component/s: Compiler Integration
    • Labels:
    • Environment:
      Eclipse 3.6, Eclipse 3.7, STS 2.6
    • Number of attachments :
      0

      Description

      I am in a need to add @Grab annotations to Grails BuildConfig file, in order to add jsch library to the classpath, because I need to declare SshResolver later in the config and this work charmingly from command line. Unfortunately, this makes Eclipse completely unusable, processor load gets to 100% and the compilation process hangs until Eclipse process eventually crashes. Here is the stack trace:

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      /reportfactory/grails-app/conf/BuildConfig.groovy: 6: Invalid duplicate class definition of class BuildConfig : The source /reportfactory/grails-app/conf/BuildConfig.groovy contains at least two definitions of the class BuildConfig.
      One of the classes is a explicit generated class using the class statement, the other is a class generated from the script body based on the file name. Solutions are to change the file name or to change the class name.
       @ line 6, column 1.
         grails.war.resources = { stagingDir ->
         ^
      
      General error during conversion: No suitable ClassLoader found for grab
      
      java.lang.RuntimeException: No suitable ClassLoader found for grab
      
      	at sun.reflect.GeneratedConstructorAccessor15.newInstance(Unknown Source)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      	at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
      	at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:198)
      	at groovy.grape.GrapeIvy.chooseClassLoader(GrapeIvy.groovy:173)
      	at groovy.grape.GrapeIvy$chooseClassLoader.callCurrent(Unknown Source)
      	at groovy.grape.GrapeIvy.grab(GrapeIvy.groovy:237)
      	at groovy.grape.Grape.grab(Grape.java:143)
      	at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:289)
      	at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:397)
      	at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:956)
      	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:587)
      	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:563)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:540)
      	at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.processToPhase(GroovyCompilationUnitDeclaration.java:168)
      	at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyParser.dietParse(GroovyParser.java:429)
      	at org.codehaus.jdt.groovy.integration.internal.MultiplexingParser.dietParse(MultiplexingParser.java:44)
      	at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:769)
      	at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:389)
      	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:475)
      	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:408)
      	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:182)
      	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:345)
      	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:61)
      	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:257)
      	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:176)
      	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
      	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
      	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
      	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
      	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
      	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
      	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
      	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
      	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
      	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
      	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
      	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
      
      2 errors
      
      	at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:306)
      	at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyErrorCollectorForJDT.failIfErrors(GroovyErrorCollectorForJDT.java:46)
      	at org.codehaus.groovy.control.ErrorCollector.addException(ErrorCollector.java:159)
      	at org.codehaus.groovy.control.SourceUnit.addException(SourceUnit.java:368)
      	at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:296)
      	at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:397)
      	at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:956)
      	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:587)
      	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:563)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:540)
      	at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.processToPhase(GroovyCompilationUnitDeclaration.java:168)
      	at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyParser.dietParse(GroovyParser.java:429)
      	at org.codehaus.jdt.groovy.integration.internal.MultiplexingParser.dietParse(MultiplexingParser.java:44)
      	at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:769)
      	at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:389)
      	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:475)
      	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:408)
      	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:182)
      	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:345)
      	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:61)
      	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:257)
      	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:176)
      	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
      	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
      	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
      	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
      	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
      	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
      	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
      	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
      	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
      	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
      	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
      	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
      /reportfactory/test/unit/com/abzreporting/reportfactory/ProjectControllerSpec.groovy: 6 Groovy:Invalid duplicate class definition of class BuildConfig : The source /reportfactory/grails-app/conf/BuildConfig.groovy contains at least two definitions of the class BuildConfig.
      /reportfactory/test/unit/com/abzreporting/reportfactory/ProjectControllerSpec.groovy: 0 General error during conversion: No suitable ClassLoader found for grab
      
      java.lang.RuntimeException: No suitable ClassLoader found for grab
      	at sun.reflect.GeneratedConstructorAccessor15.newInstance(Unknown Source)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      	at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
      	at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:198)
      	at groovy.grape.GrapeIvy.chooseClassLoader(GrapeIvy.groovy:173)
      	at groovy.grape.GrapeIvy$chooseClassLoader.callCurrent(Unknown Source)
      	at groovy.grape.GrapeIvy.grab(GrapeIvy.groovy:237)
      	at groovy.grape.Grape.grab(Grape.java:143)
      	at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:289)
      	at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:397)
      	at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:956)
      	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:587)
      	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:563)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:540)
      	at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.processToPhase(GroovyCompilationUnitDeclaration.java:168)
      	at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyParser.dietParse(GroovyParser.java:429)
      	at org.codehaus.jdt.groovy.integration.internal.MultiplexingParser.dietParse(MultiplexingParser.java:44)
      	at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:769)
      	at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:389)
      	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:475)
      	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:408)
      	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:182)
      	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:345)
      	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:61)
      	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:257)
      	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:176)
      	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
      	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
      	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
      	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
      	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
      	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
      	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
      	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
      	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
      	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
      	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
      	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
      
      

      By default STS Grails plugin includes grails-app/conf into project sources and my current workaround is to exclude it - after that Eclipse gets usable again.

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Predrag Knezevic
          • Votes:
            8 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated: