title: How to have modular Jenkins Pipeline?
body: <p>I would like to create a Jenkins declarative pipeline and would like to have the pipeline structure as following:</p>
  <pre><code>  mainPipeline.groovy
    stage1.groovy
    stage2.groovy
    stage3.groovy
  </code></pre>
  <p><code>mainPipeline</code> looks like the following:</p>
  <pre><code> pipeline {
  
        stages {
           stage('stage1') {
              // Call method from the file Stage1.groovy
           }
           stage('stage2') {
              // Call method from the file Stage2.groovy
           }
        }
   }
  </code></pre>
  <p>I have two main questions:</p>
  <ol>
  <li>How do I link these files to a Library?</li>
  <li>How do I configure Jenkins Pipeline, so that Jenkins not only knows the main JenkinsFile which is <code>mainPipeline</code> but also the submodules?</li>
  </ol>