Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0.0alpha
-
Fix Version/s: 2.6.0.Release
-
Component/s: None
-
Labels:
-
Environment:Hideeclipse.buildId=I20090611-1540
java.version=1.6.0_14
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=pl_PL
Framework arguments: -product org.eclipse.epp.package.java.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.java.product
Groovy Compiler 1.6.4 Feature 2.0.0.xx-20090925-2000-e35 org.codehaus.groovy16.feature.feature.group
Groovy-Eclipse Feature 2.0.0.xx-20090925-2000-e35 org.codehaus.groovy.eclipse.feature.feature.group
JDT Core patch for Groovy-Eclipse plugin 2.0.0.xx-20090925-2000-e35 org.codehaus.groovy.jdt.patch.feature.groupShoweclipse.buildId=I20090611-1540 java.version=1.6.0_14 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=pl_PL Framework arguments: -product org.eclipse.epp.package.java.product Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.java.product Groovy Compiler 1.6.4 Feature 2.0.0.xx-20090925-2000-e35 org.codehaus.groovy16.feature.feature.group Groovy-Eclipse Feature 2.0.0.xx-20090925-2000-e35 org.codehaus.groovy.eclipse.feature.feature.group JDT Core patch for Groovy-Eclipse plugin 2.0.0.xx-20090925-2000-e35 org.codehaus.groovy.jdt.patch.feature.group
-
Number of attachments :
Description
When I try to compile a code with a @Grab annotation:
import groovy.lang.Grab; @Grab(group="joda-time", module="joda-time", version="1.6") def printDate() { def dt = new DateTime() }
I get the following exception:
Error
Sat Sep 26 14:58:46 CEST 2009
Error in JDT Core during AST creationjava.lang.NoClassDefFoundError: org/apache/ivy/core/report/ResolveReport
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:83)
at java.security.AccessController.doPrivileged(Native Method)
at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:80)
at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:33)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:20)
at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:249)
at groovy.lang.MetaClassImpl.populateMethods(MetaClassImpl.java:341)
at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:291)
at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:2889)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:154)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:170)
at groovy.grape.GrapeIvy.$getStaticMetaClass(GrapeIvy.groovy)
at groovy.grape.GrapeIvy.<init>(GrapeIvy.groovy:49)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
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:103)
at groovy.grape.Grape.grab(Grape.java:138)
at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:176)
at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:268)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:863)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:478)
at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.processToPhase(GroovyCompilationUnitDeclaration.java:137)
at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyParser.dietParse(GroovyParser.java:115)
at org.codehaus.jdt.groovy.integration.internal.MultiplexingCommentRecorderParser.dietParse(MultiplexingCommentRecorderParser.java:48)
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.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:838)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:545)
at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:908)
at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:657)
at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:544)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:537)
at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:478)
at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:468)
at org.eclipse.jdt.ui.SharedASTProvider.getAST(SharedASTProvider.java:126)
at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:169)
at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run(SelectionListenerWithASTManager.java:154)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.lang.ClassNotFoundException: org.apache.ivy.core.report.ResolveReport
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:489)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 47 more
Couple of main issues here.
1) The ivy jar isn't part of org.codehaus.groovy right now and so the ivy classes cannot be found to satisfy the Grab. Adding this is a reasonable thing to do.
2) Once downloaded, the dependency isn't visible to the compiler building the code. I have to look into how the Grab wants to adjust the groovyclassloader classpath and build some kind of adaptor that causes the dependency to be visible in our way of doing things. I have an idea how to do this.