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

Shared library pluging - can't use getResource to load a resource?

XMLWordPrintable

      Hi there,

      I love the idea of using shared libraries! I've been trying to use it - quite successfully - until I started using resources.

      I have a directory layout similar to the one described in the documentation.

      Inside my library I have a class rendering an html template (would be Bar.groovy). This template is in the resource directory (would be bar.json).

      Unfortunately, I just can't manage to retrieve the path of the resource using:

      this.class.getResource("org/foo/bar.json")

      This always returns "null" when executed on a Jenkins server while it does return the correct file path when running locally on my machine.

       

      However, the following works like a charm:

      def request = libraryResource 'org/foo/bar.json'

       

      Is this a bug or am I doing something wrong? Any help much appreciated

            Unassigned Unassigned
            bernard87 Bernard Landon
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: