Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-9165

Grape cannot pull in picocli

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7
    • Fix Version/s: 3.0.0-beta-2
    • Component/s: Grape, groovy-runtime
    • Labels:

      Description

      If I try to run a Groovy script I am unable to pull in a newer version of picocli via @Grab:

      @Grab('info.picocli:picocli-groovy:4.0.0-beta-1b')
      @GrabExclude('org.codehaus.groovy:groovy-all')
      @picocli.groovy.PicocliScript
      @picocli.CommandLine.Command
      import picocli.CommandLine
      
      println "Groovy version ${GroovySystem.version}"
      println "Picocli version $CommandLine.VERSION"
       

      Depending on the Groovy version, this prints

      Groovy version 2.5.0
      Picocli version 3.0.2
      

      or

      Groovy version 2.5.7
      Picocli version 3.9.5
      

      So the @Grab('info.picocli:picocli-groovy:4.0.0-beta-1b') is not honoured.

      This is because the groovy.ui.GroovyMain class, which executes Groovy scripts, itself uses picocli to parse the command line parameters. Unfortunately, this means that Groovy script authors cannot control the picocli version used by their scripts.

      Is there anything we can do to improve this?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                paulk Paul King
                Reporter:
                rpopma Remko Popma
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m