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

How do we get Groovy to honor some sort of "class path" for finding Groovy classes

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • groovy-plugin
    • None
    • Multiple Jenkins under Windows

      At a recent Cloud Bees class KK could not answer this question and suggested creating a Ticket . . .

      So the issue is this, we have multiple Jenkins Instances (8 so far and growing), but with many common elements . . . in particular, many common pieces of Groovy. For this question, the "type" of Groovy is not relevant; I don't care if it is the post build plug in, Scriptler or Jenkins built in script console . . . none of them seem to work the way I would expect.

      As it stands now, what we have are all these custom Groovy scripts sprinkled among all our systems . . . We have to carry these peices of Groovy around by hand from Jenkins to Jenkins . . . an update on one system requires an update on 7 others . . . annoying and error prone. What we would like to do is to have a Groovy class script repository and instead of carrying the custom groovy from system to system, we like to make all the Groovy scripts look like this instead:

      obj = new DoSomethingClass()
      obj.DoIt()

      Now if something needs to be changed, instead of fixed 8 to 12 Jenkins instances, I fix the DOSomethingClass.groovy in Perforce and sync the update on each system . . . 100% accurate and doable via automation.

      This works easily in Groovy itself using either Groovy command line or Groovy Console. However, as soon as I tried to get at that class from any Jenkins/Groovy . . . I cannot get it to find that class. I've tried adjusting CLASSPASS and/or using the -cp switch on the JVM . . . either seem to help . . . Jenkins/Groovy just won't seems to search for things or at least won't search for them at a place I tell it to . . .

      If you have a way to make this happen . . . I'd love to hear it . . . even if I could not add a new location to the places Groovy searches for Classes . . . even knowing there was "someplace" Jenkins would search would be a big help . . . like $JENKINS_HOME/Groovy or someplace I could put classes so I can update all instances without having to go to the GUI on each Jenkins instance to make the update.

      Frank

          [JENKINS-13740] How do we get Groovy to honor some sort of "class path" for finding Groovy classes

          There are no comments yet on this issue.

            vjuranek vjuranek
            fmerrow Frank Merrow
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: