The following example code fails to execute due to the inclusion of @GrabConfig(systemClassLoader = true), which is required for the program to run in production.
I have tried running this using Groovy 2.4.7 on Eclipse Neon and on a clean install of Eclipse Neon running Groovy 2.4.13. I'm confused because it appears the line of code throwing the exception is commented out in the Groovy-Eclipse source code, but perhaps I'm looking in the wrong area. Please let me know if there is any more info I can provide to help solve this issue!
update: I also verified this does not work running the latest version of Eclipse 2018-09 running the 2.4.15 compiler.
Source Code referenced: https://github.com/groovy/groovy-eclipse/blame/337f7d8fe709d0c7d469202425153b6ed1bbfd0c/base/org.codehaus.groovy24/src/groovy/grape/GrapeIvy.groovy#L181
Code:
@Grapes([
@Grab(group='mysql', module='mysql-connector-java', version='5.1.6'),
@GrabConfig(systemClassLoader = true)
])
def a
println "Why won't this run?"
Stack Trace:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during conversion: No suitable ClassLoader found for grab
java.lang.RuntimeException: No suitable ClassLoader found for grab
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247)
at groovy.grape.GrapeIvy.chooseClassLoader(GrapeIvy.groovy:182)
at groovy.grape.GrapeIvy$chooseClassLoader.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at groovy.grape.GrapeIvy.grab(GrapeIvy.groovy:249)
at groovy.grape.Grape.grab(Grape.java:167)
at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:377)
at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:321)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:943)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
at groovy.lang.GroovyShell.run(GroovyShell.java:517)
at groovy.lang.GroovyShell.run(GroovyShell.java:507)
at groovy.ui.GroovyMain.processOnce(GroovyMain.java:590)
at groovy.ui.GroovyMain.run(GroovyMain.java:321)
at groovy.ui.GroovyMain.process(GroovyMain.java:307)
at groovy.ui.GroovyMain.processArgs(GroovyMain.java:126)
at groovy.ui.GroovyMain.main(GroovyMain.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
1 error
The following example code fails to execute due to the inclusion of @GrabConfig(systemClassLoader = true), which is required for the program to run in production.
I have tried running this using Groovy 2.4.7 on Eclipse Neon and on a clean install of Eclipse Neon running Groovy 2.4.13. I'm confused because it appears the line of code throwing the exception is commented out in the Groovy-Eclipse source code, but perhaps I'm looking in the wrong area. Please let me know if there is any more info I can provide to help solve this issue!
update: I also verified this does not work running the latest version of Eclipse 2018-09 running the 2.4.15 compiler.
Source Code referenced: https://github.com/groovy/groovy-eclipse/blame/337f7d8fe709d0c7d469202425153b6ed1bbfd0c/base/org.codehaus.groovy24/src/groovy/grape/GrapeIvy.groovy#L181
Code:
Stack Trace: