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

Add uberClassLoader to Shared Objects Groovy Scripts

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I am unable to import some classes into Shared Objects Groovy Scripts.

      [EnvInject] - [ERROR] - SEVERE ERROR occurs: startup failed:
      Script1.groovy: 2: unable to resolve class hudson.scm.SubversionSCM
      @ line 2, column 1.
      import hudson.scm.SubversionSCM;

      Initial investigation:
      GroovySharedObjectType.java

      GroovyShell groovyShell = new GroovyShell()

      Looking at how it was implemented in Environment Inject plugin, the following seems to fix my issue:

      GroovyShell shell = new GroovyShell(Hudson.getInstance().getPluginManager().uberClassLoader);

        Attachments

          Activity

          Hide
          gcummings Geoff Cummings added a comment -

          Created a pull request with this change:

          https://github.com/jenkinsci/shared-objects-plugin/pull/1

          Still learning about this, so please let me know if there is a better way to do it.

          Show
          gcummings Geoff Cummings added a comment - Created a pull request with this change: https://github.com/jenkinsci/shared-objects-plugin/pull/1 Still learning about this, so please let me know if there is a better way to do it.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: gcummings
          Path:
          src/main/java/org/jenkinsci/plugins/sharedobjects/type/GroovySharedObjectType.java
          http://jenkins-ci.org/commit/shared-objects-plugin/f97c997b8c58fcaf6040804b2f075e8af6cc80e4
          Log:
          https://issues.jenkins-ci.org/browse/JENKINS-16582
          Adding uberClassLoader to GroovyShell

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: gcummings Path: src/main/java/org/jenkinsci/plugins/sharedobjects/type/GroovySharedObjectType.java http://jenkins-ci.org/commit/shared-objects-plugin/f97c997b8c58fcaf6040804b2f075e8af6cc80e4 Log: https://issues.jenkins-ci.org/browse/JENKINS-16582 Adding uberClassLoader to GroovyShell
          Hide
          gbois Gregory Boissinot added a comment -

          Thank you very much for using this plugin.
          Your pull request is integrated.

          Show
          gbois Gregory Boissinot added a comment - Thank you very much for using this plugin. Your pull request is integrated.

            People

            Assignee:
            gbois Gregory Boissinot
            Reporter:
            gcummings Geoff Cummings
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: