title: Binding nexus credentials to maven deploy job in jenkins build
body: <p>I have a maven pom project with defined <code>distributionManagement</code> section in <code>pom.xml</code></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;project&gt;
  ...
      &lt;distributionManagement&gt;
          &lt;repository&gt;
              &lt;id&gt;my-repo&lt;/id&gt;
              &lt;url&gt;http://nexus.my.local/repository/my-private&lt;/url&gt;
          &lt;/repository&gt;
      &lt;/distributionManagement&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>in the <code>settings.xml</code> file I have set up the <code>servers</code> section</p>
  
  <pre class="lang-xml prettyprint-override"><code>  &lt;servers&gt;
      &lt;server&gt;
        &lt;id&gt;my-repo&lt;/id&gt;
        &lt;username&gt;${env.CI_DEPLOY_USERNAME}&lt;/username&gt;
        &lt;password&gt;${env.CI_DEPLOY_PASSWORD}&lt;/password&gt;
      &lt;/server&gt;
    &lt;/servers&gt;
  </code></pre>
  
  <p>in jenkins, I binded the credentials to these variables
  <img src="https://i.stack.imgur.com/87JJu.png" alt="enter image description here">
  But doing <code>mvn clean deploy</code> gives me following error</p>
  
  <pre><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project XY:
  Failed to deploy artifacts:
  Could not transfer artifact XY:pom:1.0.0 from/to my-repo (http://nexus.my.local/repository/my-private):
  Failed to transfer file: http://nexus.my.local/repository/my-private/XY-1.0.0.pom.
  Return code is: 401, ReasonPhrase: Unauthorized. -&gt; [Help 1]
  </code></pre>
  
  <p>When I echoed the variable <code>${CI_DEPLOY_USERNAME}</code> in shell before build, it gave me <code>****</code> output -> I think that is ok.
  Where else should I provide the variables? Is my project's <code>settings.xml</code> get used in maven deploy command?</p>