title: Maven: Trying to Deploy with credentials in settings.xml file
body: <p>This seemed to be working last week and now it doesn't.</p>
  
  <ul>
  <li>We use Artifactory as our Maven repository.</li>
  <li>I am deploying a jar and pom using the <code>deploy:deploy-file</code> goal</li>
  <li>Our Artifactory repository requires authentication to deploy.</li>
  </ul>
  
  <p>I can deploy to the repository by embedding my credentials in the server URL on the command line:</p>
  
  <pre><code> $ mvn deploy:deploy-file \
       -Durl=http://deployer:swordfish@repo.veggiecorp.com/artifactory/ext-release-local \
       -Dfile=crypto.jar \
       -DpomFile=pom.xml \
       -Did=VeggieCorp
    yadda...yadda...yadda...
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 0.962s
    [INFO] Finished at: Mon Aug 20 10:06:04 CDT 2012
    [INFO] Final Memory: 4M/118M
    [INFO] ------------------------------------------------------------------------
  </code></pre>
  
  <p>However, that whole deployment gets logged and my credentials would be visible in the log. Therefore, I want to be able to deploy without my credentials on the command line. To do that, I have a <code>$HOME/.m2/settings.xml</code> file:</p>
  
  <pre><code>&lt;settings&gt;
      &lt;proxies&gt;
          &lt;proxy&gt;
              &lt;active&gt;true&lt;/active&gt;
              &lt;protocol&gt;http&lt;/protocol&gt;
              &lt;host&gt;proxy.veggiecorp.com&lt;/host&gt;
              &lt;port&gt;3128&lt;/port&gt;
              &lt;nonProxyHosts&gt;*.veggiecorp.com&lt;/nonProxyHosts&gt;
          &lt;/proxy&gt;
      &lt;/proxies&gt;
      &lt;servers&gt;
          &lt;server&gt;
              &lt;id&gt;VeggieCorp&lt;/id&gt;
              &lt;username&gt;deployer&lt;/username&gt;
              &lt;password&gt;swordfish&lt;/password&gt;
          &lt;/server&gt;
      &lt;/servers&gt;
      &lt;profiles&gt;
          &lt;profile&gt;
              &lt;id&gt;VeggieCorp&lt;/id&gt;
              &lt;activation&gt;
                   &lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
              &lt;/activation&gt;
              &lt;repositories&gt;
                  &lt;repository&gt;
                      &lt;id&gt;VeggieCorp&lt;/id&gt;
                      &lt;name&gt;VeggieCorp's Maven Repository&lt;/name&gt;
                      &lt;releases&gt;
                          &lt;enabled&gt;true&lt;/enabled&gt;
                          &lt;updatePolicy&gt;always&lt;/updatePolicy&gt;
                          &lt;checksumPolicy&gt;warn&lt;/checksumPolicy&gt;
                      &lt;/releases&gt;
                      &lt;snapshots&gt;
                          &lt;enabled&gt;false&lt;/enabled&gt;
                          &lt;updatePolicy&gt;always&lt;/updatePolicy&gt;
                          &lt;checksumPolicy&gt;warn&lt;/checksumPolicy&gt;
                      &lt;/snapshots&gt;
                      &lt;url&gt;http://repo.veggiecorp.com/artifactory/ext-release-local&lt;/url&gt;
                      &lt;layout&gt;default&lt;/layout&gt;
                  &lt;/repository&gt;
              &lt;/repositories&gt;
          &lt;/profile&gt;
      &lt;/profiles&gt;
      &lt;activeProfiles&gt;
          &lt;activeProfile&gt;VeggieCorp&lt;/activeProfile&gt;
      &lt;/activeProfiles&gt;
  &lt;/settings&gt;
  </code></pre>
  
  <p>Now, I'll try deploying again, but without putting the user name and password in the URL:</p>
  
  <pre><code> $ mvn deploy:deploy-file \
       -Durl=http://repo.veggiecorp.com/artifactory/ext-release-local \
       -Dfile=crypto.jar \
       -DpomFile=pom.xml \
       -Did=VeggieCorp
  yadda...yadda...yadda
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 0.751s
  [INFO] Finished at: Mon Aug 20 10:17:15 CDT 2012
  [INFO] Final Memory: 4M/119M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-  file (default-cli) on project crypto:
   Failed to deploy artifacts: Could not transfer artifact  
      com.veggiecorp:crypto:jar:2.0.0 from/to remote-repository 
      (http://mvn.veggiecorp.com/artifactory/ext-release-local):
      Failed to transfer file:
      http://mvn.veggiecorp.com/artifactory/ext-release-local/com/veggiecorp/crypto/2.0.0/crypto-2.0.0.jar.
      Return code is: 401, ReasonPhrase:Unauthorized. -&gt; [Help 1]
  </code></pre>
  
  <p>(I've reformatted the output to make it easier to see. I'm getting a 401 "Unauthorized" error)</p>
  
  <p>So, what am I doing wrong? Why can't I use my <code>.settings.xml</code> file to do my credentials? The proxy part does work because it can download the needed plugins from the main Maven repository.</p>