title: How to Set multiple credentials using withcredentials in jenkins pipeline groovy file
body: <p>I need to set two or more credentials to a job, my plan is to use it separately like below, so that it can be used in multiple jobs</p>
  
  <pre><code>static void _artifactoryCredentialBinding(Job job) {
      job.with {
          wrappers {
              credentialsBinding {
                  usernamePassword('USERNAME', 'PASSWORD', 'xxxxx')
              }
          }
      }
  }
  
  static void _jasyptCredentialBinding(Job job) {
      return job.with {
          wrappers {
              credentialsBinding {
                  usernamePassword('', 'PASSWORD', 'jasypt-credentials')
              }
          }
      }
  }
  </code></pre>
  
  <p>When I do this the first credential is getting over ridden by the second credential.</p>
  
  <p>I will be calling these two methods as a helper method in where ever necessary in my groovy file.</p>
  
  <p>I would require to add multiple credentials in few jobs and only one credential in a job.</p>
  
  <p>Adding the credentials under one wrapper will work - <a href="https://stackoverflow.com/questions/47475160/how-to-use-multiple-credentials-in-withcredentials-in-jenkins-pipeline">multiple-credentials</a>, but I will not be able to reuse if I add multiple under the same.</p>
  
  <p>I tried returning the Job in the above methods and used the same methods to set the creds but getting the error while building -</p>
  
  <blockquote>
    <p>ERROR: (CredentialBindingUtil.groovy, line 28) No signature of method: xxxx.CredentialBindingUtil$__pfJasyptCredentialBinding_closure3.wrappers() is applicable for argument types: (xxx.CredentialBindingUtil$__pfJasyptCredentialBinding_closure3$_closure9) values: [xxxx.CredentialBindingUtil$__pfJasyptCredentialBinding_closure3$_closure9@11b4d391]
    [Office365connector] No webhooks to notify</p>
  </blockquote>
  
  <p>How do I make the credentials to be appended with the existing ones ?</p>