title: Jenkins Shared Library src class - unable to resolve class
body: <p>I am looking for some guidance on the design of a Jenkins Shared Library class. Using global vars as shared library is working fine but everytime I define a class in src/ and I want to import it, I get the error unable to resolve class.</p>
  
  <p>This is my shared library structure:</p>
  
  <pre><code>src
    - de
     - schlumpf
       - Tester.groovy
  vars
    - sayHello.groovy
  </code></pre>
  
  <p><strong>Class Tester.groovy</strong></p>
  
  <p>Here is the code of my class which I want to initialize inside a pipeline job. </p>
  
  <pre><code>package de.schlumpf
  
  public class Tester implements Serializable {
    public String name = "test"
  
    Tester(String pName) {
      this.name = pName
    }
  
    def sayHi() {
      echo "Hello, ${this.name}."
    }
  
    def sayHi(String name) {
      echo "Hello, ${name}."
    }
  }
  </code></pre>
  
  <p><strong>Var sayHello.groovy</strong></p>
  
  <pre><code>#!/usr/bin/env groovy
  
  def call(String name = 'human') {
    echo "Hello, ${name}."
  }
  </code></pre>
  
  <p><strong>Pipeline Job</strong></p>
  
  <pre><code>@Library('pipeline-library-demo')
  import de.schlumpf.Tester //de.schlumpf doesn't work as well
  
  stage('Demo') {
      echo 'Hello world'
      sayHello 'test'
  
      def t = new Tester('Alice')
      t.sayHi()
  }
  </code></pre>
  
  <p>In line 2 I get the error: <em>Unable to resolve class de.schlumpf.Tester</em>. The global variable sayHello works like a charm... Does anyone know what I am doing wrong here?</p>
  
  <p>The Shared Libary is imported in the System settings:
  <a href="https://i.stack.imgur.com/SPa8B.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SPa8B.png" alt="enter image description here"></a></p>
  
  <p>I know this looks similar to this one, but I can't find a typo or something in my path...
  <a href="https://stackoverflow.com/questions/50005082/using-jenkins-shared-libraries-as-classes">Using Jenkins Shared Libraries as classes</a></p>
  
  <p>The official documentation is here: <a href="https://jenkins.io/doc/book/pipeline/shared-libraries/" rel="noreferrer">https://jenkins.io/doc/book/pipeline/shared-libraries/</a></p>
  
  <p><strong>Version</strong></p>
  
  <ul>
  <li>Jenkins: ver. 2.150.1</li>
  <li>Pipeline 2.6</li>
  <li>Pipeline: Groovy 2.61.1</li>
  <li>Pipeline: Shared Groovy Libraries 2.12   </li>
  </ul>