You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2020/02/17 08:46:00 UTC

[jira] [Commented] (GROOVY-9404) NoClassDefFoundError: picocli/CommandLine$ParameterException in scripts after update to Groovy 3.0.0

    [ https://issues.apache.org/jira/browse/GROOVY-9404?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17038158#comment-17038158 ] 

Paul King commented on GROOVY-9404:
-----------------------------------

I think this was an intended change to allow folks to use whatever version of picocli they would like.
You can use CliBuilderInternal to get the bundled version.

> NoClassDefFoundError: picocli/CommandLine$ParameterException in scripts after update to Groovy 3.0.0
> ----------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-9404
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9404
>             Project: Groovy
>          Issue Type: Bug
>          Components: command line processing
>    Affects Versions: 3.0.0
>         Environment: Linux
>            Reporter: Dirk Heinrichs
>            Priority: Major
>
> After update from Groovy 2.5.x to 3.0.0, scripts using picocli are failing with the following error:
> {code:java}
> NoClassDefFoundError: picocli/CommandLine$ParameterException{code}
> Here's a small example showing the problem:
> {code:java}
> import groovy.cli.picocli.CliBuilder
> def cli = new CliBuilder(name: 'cliTest.groovy')
> cli.h(type: Boolean, longOpt: 'help', usageHelp: true, required: false, 'Show usage information')
> cli.c(type: String, longOpt: 'config', required: true, args: 1, 'Path to config file (required)')
> def opts = cli.parse(args)
> opts || System.exit(1)
> if(opts.h) {
>   cli.usage()
>   System.exit(0)
> }
> println(opts.c)
> {code}
> Running this with Groovy 2.5.7 works:
> {code:java}
> % ~/tmp/groovy-2.5.7/bin/groovy ./cliTest.groovy -c data/config_prod.yaml 
> data/config_prod.yaml{code}
> But with 3.0.0, it does not:
> {code:java}
> % ~/tmp/groovy-3.0.0/bin/groovy ./cliTest.groovy -c data/config_prod.yaml
> Caught: java.lang.NoClassDefFoundError: picocli/CommandLine$ParameterException
> java.lang.NoClassDefFoundError: picocli/CommandLine$ParameterException
>         at cliTest.run(cliTest.groovy:4)
>         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)
> Caused by: java.lang.ClassNotFoundException: picocli.CommandLine$ParameterException
>         ... 4 more{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)