Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Editor
    • Labels:
    • Environment:
      SpringSource Tool Suite 2.6.1, Java 1.6.0_24 on Mac OSX 10.6.7
    • Number of attachments :
      2

      Description

      I pasted the HTTPBuilder example from http://groovy.codehaus.org/HTTP+Builder and the editor highlights the import static groovyx.net.http.ContentType.* line with "Groovy:unable to resolve class groovyx.net.http.ContentType" and the new HTTPBuilder with a similar error.

      I'm attaching the script here for convenience.

      I can run the script from STS with no problems (except for some log4j errors which I think are not related).

      1. GRECLIPSE-1052.tar.gz
        1 kB
        Daniel Serodio
      2. HTTP_Builder_sample.groovy
        0.9 kB
        Daniel Serodio

        Activity

        Hide
        Andrew Thorburn added a comment - - edited

        I'm getting the same issue. The stack trace (included below) indicates that Grapes in Eclipse is not able to find JSCH jars, which I have included in ~/.groovy/lib (so the script runs just fine). I'm not sure why Ivy is attempting to use the SSHResolver, as that's not part of the resolver chains... Thoughts on how to fix this?

        EDIT: I'm using a custom ~/.groovy/grapeConfig.xml, which includes an ssh resolver (but as I said, it's not part of the resolver chain. The resolver chain includes a file system resolver and an http resolver), and I've got the following script:

        package main
        
        import static groovyx.gpars.GParsPool.*
        import static groovyx.gpars.dataflow.DataFlow.*
        
        @Grab("org.codehaus.gpars:gpars")
        private class GRAPEHOLDER {
        }
        
        withPool(2) {
        	10.times {
        		task {
        			println "hello"
        		}
        	}
        }
        

        Errors appear on both the import lines, indicating that the class cannot be found, but if I run the script (from inside Eclipse, even), it works just fine.

        General error during conversion: Transform groovy.grape.GrabAnnotationTransformation@395d9cdb 
         cannot be run org.codehaus.groovy.GroovyException: Transform groovy.grape.GrabAnnotationTransformation@395d9cdb cannot be run at 
         org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:420) at 
         org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:920) at 
         org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:588) at 
         org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:564) at 
         org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:541) 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.IncrementalImageBuilder.compile(IncrementalImageBuilder.java:322) at
         org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:345) at
         org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:135) at
         org.eclipse.jdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:268) at
         org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:196)  at
         org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629) at 
         org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at 
         org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:172) at 
         org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:203) at 
         org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:255) at 
         org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at 
         org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:258) at 
         org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:311) at 
         org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:343) at 
         org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144) at 
         org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:242) at 
         org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
         Caused by: java.lang.NoClassDefFoundError: com/jcraft/jsch/JSchException at
         org.apache.ivy.plugins.resolver.SshResolver.<init>(SshResolver.java:28) at
         sun.reflect.GeneratedConstructorAccessor29.newInstance(Unknown Source) at 
         sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at
         java.lang.reflect.Constructor.newInstance(Constructor.java:513) at 
         java.lang.Class.newInstance0(Class.java:355) at java.lang.Class.newInstance(Class.java:308) at 
         org.apache.ivy.util.Configurator.addChild(Configurator.java:586) at 
         org.apache.ivy.util.Configurator.startCreateChild(Configurator.java:503) at 
         org.apache.ivy.core.settings.XmlSettingsParser.inConfiguratorStarted(XmlSettingsParser.java:579) at 
         org.apache.ivy.core.settings.XmlSettingsParser.startElement(XmlSettingsParser.java:201) at 
         com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501) at 
         com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1363) at 
         com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755) at 
         com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at 
         com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at 
         com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at
         com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at
         com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at 
         com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at 
         com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at
         javax.xml.parsers.SAXParser.parse(SAXParser.java:395) at
         javax.xml.parsers.SAXParser.parse(SAXParser.java:277) at
         org.apache.ivy.core.settings.XmlSettingsParser.doParse(XmlSettingsParser.java:160) at
         org.apache.ivy.core.settings.XmlSettingsParser.parse(XmlSettingsParser.java:150) at
         org.apache.ivy.core.settings.IvySettings.load(IvySettings.java:388) at
         org.apache.ivy.core.settings.IvySettings$load.call(Unknown Source) at 
         groovy.grape.GrapeIvy.<init>(GrapeIvy.groovy:85) at 
         sun.reflect.GeneratedConstructorAccessor20.newInstance(Unknown Source) at 
         sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at
         java.lang.reflect.Constructor.newInstance(Constructor.java:513) at 
         java.lang.Class.newInstance0(Class.java:355) at
         java.lang.Class.newInstance(Class.java:308) at 
         groovy.grape.Grape.getInstance(Grape.java:101) at
         groovy.grape.Grape.grab(Grape.java:136) at 
         groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:282) at 
         org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:397) ... 28 more
         Caused by: java.lang.ClassNotFoundException: com.jcraft.jsch.JSchException at 
         org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506) at 
         org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422) at 
         org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410) at 
         org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) at 
         java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 64 more
        
        Show
        Andrew Thorburn added a comment - - edited I'm getting the same issue. The stack trace (included below) indicates that Grapes in Eclipse is not able to find JSCH jars, which I have included in ~/.groovy/lib (so the script runs just fine). I'm not sure why Ivy is attempting to use the SSHResolver, as that's not part of the resolver chains... Thoughts on how to fix this? EDIT: I'm using a custom ~/.groovy/grapeConfig.xml, which includes an ssh resolver (but as I said, it's not part of the resolver chain. The resolver chain includes a file system resolver and an http resolver), and I've got the following script: package main import static groovyx.gpars.GParsPool.* import static groovyx.gpars.dataflow.DataFlow.* @Grab( "org.codehaus.gpars:gpars" ) private class GRAPEHOLDER { } withPool(2) { 10.times { task { println "hello" } } } Errors appear on both the import lines, indicating that the class cannot be found, but if I run the script (from inside Eclipse, even), it works just fine. General error during conversion: Transform groovy.grape.GrabAnnotationTransformation@395d9cdb cannot be run org.codehaus.groovy.GroovyException: Transform groovy.grape.GrabAnnotationTransformation@395d9cdb cannot be run at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:420) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:920) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:588) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:564) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:541) 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.IncrementalImageBuilder.compile(IncrementalImageBuilder.java:322) at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:345) at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:135) at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:268) at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:196) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:172) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:203) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:255) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:258) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:311) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:343) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144) at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:242) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) Caused by: java.lang.NoClassDefFoundError: com/jcraft/jsch/JSchException at org.apache.ivy.plugins.resolver.SshResolver.<init>(SshResolver.java:28) at sun.reflect.GeneratedConstructorAccessor29.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at java.lang. Class .newInstance0( Class .java:355) at java.lang. Class .newInstance( Class .java:308) at org.apache.ivy.util.Configurator.addChild(Configurator.java:586) at org.apache.ivy.util.Configurator.startCreateChild(Configurator.java:503) at org.apache.ivy.core.settings.XmlSettingsParser.inConfiguratorStarted(XmlSettingsParser.java:579) at org.apache.ivy.core.settings.XmlSettingsParser.startElement(XmlSettingsParser.java:201) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1363) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at javax.xml.parsers.SAXParser.parse(SAXParser.java:395) at javax.xml.parsers.SAXParser.parse(SAXParser.java:277) at org.apache.ivy.core.settings.XmlSettingsParser.doParse(XmlSettingsParser.java:160) at org.apache.ivy.core.settings.XmlSettingsParser.parse(XmlSettingsParser.java:150) at org.apache.ivy.core.settings.IvySettings.load(IvySettings.java:388) at org.apache.ivy.core.settings.IvySettings$load.call(Unknown Source) at groovy.grape.GrapeIvy.<init>(GrapeIvy.groovy:85) at sun.reflect.GeneratedConstructorAccessor20.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at java.lang. Class .newInstance0( Class .java:355) at java.lang. Class .newInstance( Class .java:308) at groovy.grape.Grape.getInstance(Grape.java:101) at groovy.grape.Grape.grab(Grape.java:136) at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:282) at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:397) ... 28 more Caused by: java.lang.ClassNotFoundException: com.jcraft.jsch.JSchException at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) at java.lang. ClassLoader .loadClass( ClassLoader .java:248) ... 64 more
        Hide
        Andrew Eisenberg added a comment -

        Andrew, as a workaround, the Groovy Libraries classpath container can include jars from your .groovy/lib folder. Select the classpath container, right-click -> Properties. You can configure it there. (This does not fix the actual bug, but might get you working again inside of Eclipse.)

        Show
        Andrew Eisenberg added a comment - Andrew, as a workaround, the Groovy Libraries classpath container can include jars from your .groovy/lib folder. Select the classpath container, right-click -> Properties. You can configure it there. (This does not fix the actual bug, but might get you working again inside of Eclipse.)
        Hide
        Andrew Thorburn added a comment -

        Sorry if I wasn't clear on this: I do have the JARs in ~/.groovy/lib, and that does allow the script to run in Eclipse (and they do show up in the Groovy Libraries classpath container). The problem is not that I can't run the script from inside Eclipse, but that Eclipse can't compile the script.

        Show
        Andrew Thorburn added a comment - Sorry if I wasn't clear on this: I do have the JARs in ~/.groovy/lib, and that does allow the script to run in Eclipse (and they do show up in the Groovy Libraries classpath container). The problem is not that I can't run the script from inside Eclipse, but that Eclipse can't compile the script.
        Hide
        Radim Kolar added a comment -

        I dont think that this is minor bug. Its pretty major. You cant use @Grab in Eclipse programs.

        Show
        Radim Kolar added a comment - I dont think that this is minor bug. Its pretty major. You cant use @Grab in Eclipse programs.
        Hide
        Igor Mukhin added a comment -

        same story.
        Can't write any scripts without Grab

        Show
        Igor Mukhin added a comment - same story. Can't write any scripts without Grab
        Hide
        Andy Clement added a comment -

        @Radim @Igor If you have failing scenarios, please try to include some testcode. The basic stuff I am trying with Grab is working just fine. The original HTTP sample attached here works.

        Andrew's scenario is more complex than the basic stuff - to progress that I'd need more details on the grapeConfig.xml being used since it is different to the default behaviour.

        Show
        Andy Clement added a comment - @Radim @Igor If you have failing scenarios, please try to include some testcode. The basic stuff I am trying with Grab is working just fine. The original HTTP sample attached here works. Andrew's scenario is more complex than the basic stuff - to progress that I'd need more details on the grapeConfig.xml being used since it is different to the default behaviour.
        Hide
        Andrew Eisenberg added a comment -

        Waiting on feedback from users, so won't fix for 2.6.0. If you are having problems with grab in Groovy-Eclipse, then please attach a sample failing project.

        Show
        Andrew Eisenberg added a comment - Waiting on feedback from users, so won't fix for 2.6.0. If you are having problems with grab in Groovy-Eclipse, then please attach a sample failing project.
        Hide
        Daniel Serodio added a comment - - edited

        Sample failing project attached

        Show
        Daniel Serodio added a comment - - edited Sample failing project attached

          People

          • Assignee:
            Unassigned
            Reporter:
            Daniel Serodio
          • Votes:
            9 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated: