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

ClassNotFoundException when attempting to use Picocli via Grapes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.0, 3.0.1
    • 3.0.4
    • Grape
    • None
    • Reproduced under both macOS (Groovy 3.0.1 installed manually and via MacPorts) and Debian (Groovy installed via SDKMAN).

    Description

      (Issue originally raised as: https://github.com/remkop/picocli/issues/970)

      Consider the following minimal script:

      @Grab('info.picocli:picocli:4.2.0')
      import groovy.cli.picocli.CliBuilder
      
      def cli = new CliBuilder()
      

      Under Groovy 2.5.9, this runs without error; with 3.0.1, however, I see:

      $ groovy cli.groovy 
      Caught: java.lang.NoClassDefFoundError: picocli/CommandLine$ParameterException
      java.lang.NoClassDefFoundError: picocli/CommandLine$ParameterException
      at cli.run(cli.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
      

      The jar is definitely downloaded to ~/.groovy/grapes and both versions of Groovy output

      Resolving dependency: info.picocli#picocli;4.2.0 {default=[default]}
      Preparing to download artifact info.picocli#picocli;4.2.0!picocli.jar
      

      when -Dgroovy.grape.report.downloads=true is supplied.

      Attachments

        Activity

          People

            rpopma Remko Popma
            marcs Marc
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: