I commented on the relevant picocli issues. The 2.4.x TestNG runner is being loaded by Groovy 4. This is mostly due to the maven coordinate change from org.codehaus.groovy to org.apache.groovy. When switching to Groovy 4, you will want to exclude the org.codehaus.groovy references to Groovy. You can set up a Gradle build file to convert such clashes automatically but it is probably just as easy to exclude explicitly.
Cheers, Paul. On Tue, Jan 24, 2023 at 10:17 AM Remko Popma <remko.po...@gmail.com> wrote: > Hi all, > > Some people reported that since picocli 4.7.0 was released, groovy scripts > that use picocli no longer work, showing this error message: > > Cannot cast object 'org.codehaus.groovy.testng.TestNgRunner@7afbf561' with > class 'org.codehaus.groovy.testng.TestNgRunner' to class > 'org.apache.groovy.plugin.GroovyRunner' > > Details of this issue are here: > https://github.com/remkop/picocli/issues/1885 > > It appears that the TestNgRunner somehow takes priority over GroovyRunner? > > This may have been caused by a change in picocli 4.7.0 that brought in > groovy-all as a dependency (https://github.com/remkop/picocli/issues/1613 > ). > > Has anyone seen something similar? > Is there a way to exclude TestNgRunner when executing Groovy scripts, for > example? > > Any pointers would be welcome! > Remko > > >