Using libraries Shared Libraries marked  Load implicitly  allows Pipelines to immediately use classes or global variables defined by any such libraries. To access other shared libraries, the  Jenkinsfile  needs to use the  @Library  annotation, specifying the library’s name: The annotation can be anywhere in the script where an annotation is permitted by Groovy. When referring to class libraries (with  src/  directories), conventionally the annotation goes on an  import statement: For Shared Libraries which only define Global Variables (<code>vars/</code>), or a <code>Jenkinsfile</code> which only needs a Global Variable, the <a href="http://groovy-lang.org/objectorientation.html#<em>annotation">annotation</a> pattern <code>@Library('my-shared-library') _</code> may be useful for keeping code concise. In essence, instead of annotating an unnecessary <code>import</code> statement, the symbol <code></em></code> is annotated. It is not recommended to  import  a global variable/function, since this will force the compiler to interpret fields and methods as  static  even if they were intended to be instance. The Groovy compiler in this case can produce confusing error messages. Libraries are resolved and loaded during  compilation  of the script, before it starts executing. This allows the Groovy compiler to understand the meaning of symbols used in static type checking, and 62 TIP @Library('my-shared-library') _ /* Using a version specifier, such as branch, tag, etc */ @Library('my-shared-library@1.0') _ /* Accessing multiple libraries with one statement */ @Library(['my-shared-library', 'otherlib@abc1234']) _ @Library('somelib') import com.mycorp.pipeline.somelib.UsefulClass