Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-61043

@Grab ignores package version if bundled in plugin

      When using @Grab with a package that is already bundled inside a plugin, the version inside the plugin is used instead of the one defined in @Grab.

      Example to reproduce:

      1. Install Blue Ocean plugin (1.22.0) on vanilla Jenkins (2.204.2) (make sure AWS Steps plugin is not installed).
      2. Create a pipeline job with the following content and disabled sandbox:
      @Grab('org.yaml:snakeyaml:1.19')
      import org.yaml.snakeyaml.LoaderOptions
      LoaderOptions options = new LoaderOptions()
      options.setAllowDuplicateKeys(false)
      

      Result:

      hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: org.yaml.snakeyaml.LoaderOptions.setAllowDuplicateKeys() is applicable for argument types: (java.lang.Boolean) values: [false]

       Without Blue Ocean plugin installed the job is able to execute the method.

          [JENKINS-61043] @Grab ignores package version if bundled in plugin

          Tobias Erbshäußer created issue -
          Tobias Erbshäußer made changes -
          Description Original: When using @Grab with a package that is already bundled inside a plugin, the version inside the plugin is used instead of the one defined in @Grab.

          Example to reproduce:
           # Install Blue Ocean plugin (1.22.0) on vanilla Jenkins (2.204.2) (make sure AWS Steps plugin is not installed).
           # Create a pipeline job with the following content and disabled sandbox:

           
          {code:java}
          @Grab('org.yaml:snakeyaml:1.19')
          import org.yaml.snakeyaml.LoaderOptions
          LoaderOptions options = new LoaderOptions()
          options.setAllowDuplicateKeys(false)
          {code}

           # Result:

          {noformat}
          hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: org.yaml.snakeyaml.LoaderOptions.setAllowDuplicateKeys() is applicable for argument types: (java.lang.Boolean) values: [false]{noformat}

           
          New: When using @Grab with a package that is already bundled inside a plugin, the version inside the plugin is used instead of the one defined in @Grab.

          Example to reproduce:
           # Install Blue Ocean plugin (1.22.0) on vanilla Jenkins (2.204.2) (make sure AWS Steps plugin is not installed).
           # Create a pipeline job with the following content and disabled sandbox:

          {code:java}
          @Grab('org.yaml:snakeyaml:1.19')
          import org.yaml.snakeyaml.LoaderOptions
          LoaderOptions options = new LoaderOptions()
          options.setAllowDuplicateKeys(false)
          {code}
          Result:
          {noformat}
          hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: org.yaml.snakeyaml.LoaderOptions.setAllowDuplicateKeys() is applicable for argument types: (java.lang.Boolean) values: [false]{noformat}
           Without Blue Ocean plugin installed the job is able to execute the method.
          Tobias Erbshäußer made changes -
          Component/s New: workflow-cps-global-lib-plugin [ 21714 ]
          Component/s Original: groovy-plugin [ 15549 ]

            vjuranek vjuranek
            terbs Tobias Erbshäußer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: