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

Add uberClassLoader to Shared Objects Groovy Scripts

XMLWordPrintable

      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);

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

              Created:
              Updated:
              Resolved: