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

Add uberClassLoader to Shared Objects Groovy Scripts

    XMLWordPrintable

Details

    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

          gcummings Geoff Cummings created issue -
          gbois Gregory Boissinot made changes -
          Field Original Value New Value
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 147405 ] JNJira + In-Review [ 192387 ]

          People

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

            Dates

              Created:
              Updated:
              Resolved: