You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java.lang.IllegalStateException: Error registering runner class 'org.codehaus.groovy.testng.TestNgRunner'
at groovy.grape.GrapeIvy$_processRunners_closure6.doCall(GrapeIvy.groovy:414)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:279)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1009)
at groovy.lang.Closure.call(Closure.java:418)
at groovy.lang.Closure.call(Closure.java:434)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2386)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2371)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2412)
at groovy.grape.GrapeIvy.processRunners(GrapeIvy.groovy:409)
at groovy.grape.GrapeIvy.processMetaInfServices(GrapeIvy.groovy:386)
at groovy.grape.GrapeIvy.grab(GrapeIvy.groovy:289)
at groovy.grape.Grape$1.run(Grape.java:172)
at groovy.grape.Grape$1.run(Grape.java:158)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at groovy.grape.Grape.grab(Grape.java:158)
at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:380)
at org.codehaus.groovy.transform.ASTTransformationVisitor.lambda$addPhaseOperationsForGlobalTransforms$5(ASTTransformationVisitor.java:377)
at org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:896)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:692)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:666)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:373)
at groovy.lang.GroovyClassLoader.lambda$parseClass$2(GroovyClassLoader.java:316)
at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:314)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:572)
at groovy.lang.GroovyShell.run(GroovyShell.java:392)
at groovy.lang.GroovyShell.run(GroovyShell.java:382)
at groovy.ui.GroovyMain.processOnce(GroovyMain.java:649)
at groovy.ui.GroovyMain.run(GroovyMain.java:389)
at groovy.ui.GroovyMain.access$1400(GroovyMain.java:67)
at groovy.ui.GroovyMain$GroovyCommand.process(GroovyMain.java:313)
at groovy.ui.GroovyMain.processArgs(GroovyMain.java:141)
at groovy.ui.GroovyMain.main(GroovyMain.java:114)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:132)
Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'org.codehaus.groovy.testng.TestNgRunner@7afbf561' with class 'org.codehaus.groovy.testng.TestNgRunner' to class 'org.apache.groovy.plugin.GroovyRunner'
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:424)
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:335)
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:255)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:621)
at groovy.grape.GrapeIvy$_processRunners_closure6.doCall(GrapeIvy.groovy:412)
... 45 more
Running groovy -v returns
Groovy Version: 4.0.6 JVM: 11.0.17 Vendor: Eclipse Adoptium OS: Linux
The text was updated successfully, but these errors were encountered:
I am not sure how you are setting the classpath for your script. Since the maven coordinates changed from org.codehaus.groovy to org.apache.groovy with Groovy 4, you are possibly getting both Groovy 2.4.x (from picocli dependencies) along with Groovy 4 runners. The Groovy 4 testng runner has full package of org.apache.groovy.plugin.testng.TestNgRunner. Your stacktrace is showing the old 2.4.x runner org.codehaus.groovy.testng.TestNgRunner. You will want to exclude that from your classpath.
Thank you @paulk-asert for pointing that out, and for providing the workaround (in #1874)!
@GrabExclude('org.codehaus.groovy:groovy-all')
This issue was caused by #1613, which made picocli-groovy bring in the (old) org.codehaus.groovy:groovy-all dependency. Since any Groovy script will already need to have a Groovy environment in which it is run, picocli-groovy should not try to bring in Groovy op top of that.
This is fixed in the main branch now and the fix will be part of the picocli 4.7.1 release. Until then, please use the above workaround.
Running the example code at https://picocli.info/#_groovy_scripts results in the following exception:
Running
groovy -v
returnsThe text was updated successfully, but these errors were encountered: