I think I found a way to fix this. See https://github.com/apache/groovy/pull/696 This PR adds CliBuilder.setParser and CliBuilder.setFormatter methods that ignore the specified value and print a warning to stderr.
On Sun, May 6, 2018 at 9:14 PM, Remko Popma <[email protected]> wrote: > In 2.5.0-rc-2, groovy.util.CliBuilder delegates to > groovy.cli.picocli.CliBuilder. The error is that the `parser` property of > this class is no longer writable. > > You can resolve this with 2.5.0-rc-2 by either not setting the `parser` > property in the CliBuilder constructor or using the > groovy.cli.commons.CliBuilder instead. > > On the Groovy side I’m not sure what the best way is to make the > transition easier. The picocli version of CliBuilder can not make use of > the Commons-CLI parser class. We could modify CliBuilder to silently > ignore the specified parser. (We’d have to rename the picocli ParserSpec > `parser` property in CliBuilder to something else.) > > Thoughts? > > > On Sun, May 6, 2018 at 20:35 Keegan Witt <[email protected]> wrote: > >> FYI 2.5.0-rc-2 breaks Gant. Specifically, it's caused by changing >> groovy.util.CliBuilder to use Picocli >> >> java.lang.reflect.InvocationTargetException >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at sun.reflect.NativeMethodAccessorImpl.invoke( >> NativeMethodAccessorImpl.java:62) >> at sun.reflect.DelegatingMethodAccessorImpl.invoke( >> DelegatingMethodAccessorImpl.java:43) >> at java.lang.reflect.Method.invoke(Method.java:498) >> at org.codehaus.groovy.tools.GroovyStarter.rootLoader( >> GroovyStarter.java:114) >> at org.codehaus.groovy.tools.GroovyStarter.main( >> GroovyStarter.java:136) >> Caused by: groovy.lang.ReadOnlyPropertyException: Cannot set readonly >> property: parser for class: groovy.util.CliBuilder >> at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2746) >> at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3782) >> at groovy.lang.MetaClassImpl.setProperties(MetaClassImpl. >> java:1759) >> at org.codehaus.groovy.runtime.callsite.ConstructorSite$ >> NoParamSite.callConstructor(ConstructorSite.java:125) >> at org.codehaus.groovy.runtime.callsite.CallSiteArray. >> defaultCallConstructor(CallSiteArray.java:59) >> at org.codehaus.groovy.runtime.callsite.AbstractCallSite. >> callConstructor(AbstractCallSite.java:238) >> at org.codehaus.groovy.runtime.callsite.AbstractCallSite. >> callConstructor(AbstractCallSite.java:250) >> at gant.Gant.processArgs(Gant.groovy:463) >> at gant.Gant$processArgs.call(Unknown Source) >> at org.codehaus.groovy.runtime.callsite.CallSiteArray. >> defaultCall(CallSiteArray.java:47) >> at org.codehaus.groovy.runtime.callsite.AbstractCallSite. >> call(AbstractCallSite.java:116) >> at org.codehaus.groovy.runtime.callsite.AbstractCallSite. >> call(AbstractCallSite.java:128) >> at gant.Gant.main(Gant.groovy:668) >> ... 6 more >> >> The line in Gant is >> def cli = new CliBuilder(usage: 'gant [option]* [target]*', parser: new >> GnuParser()) >> >> Was this breakage intentional? I think a lot of stuff will break with >> parser not being able to be set anymore. >> >> -Keegan >> >
