title: Maven: Failed to deploy artifacts, Acces denied
body: <p>I have a Sonatype Nexus server and I want to deploy a snapshot.</p>
  
  <p>This is a snippet of my settings.xml file:</p>
  
  <pre><code>&lt;servers&gt;
    &lt;server&gt;
      &lt;id&gt;test-snapshots&lt;/id&gt;
      &lt;username&gt;myname1&lt;/username&gt;
      &lt;password&gt;mypasswd1&lt;/password&gt;
    &lt;/server&gt;
    &lt;server&gt;
      &lt;id&gt;test-releases&lt;/id&gt;
      &lt;username&gt;myname2&lt;/username&gt;
      &lt;password&gt;mypasswd2&lt;/password&gt;
    &lt;/server&gt;
  &lt;/servers&gt;
  </code></pre>
  
  <p>And this a snippet of my pom.xml file:</p>
  
  <pre><code>&lt;distributionManagement&gt;
    &lt;repository&gt;
      &lt;id&gt;test-releases&lt;/id&gt;
      &lt;name&gt;Releases&lt;/name&gt;
      &lt;url&gt;https://nxs.company.com/content/repositories/test-releases&lt;/url&gt;
    &lt;/repository&gt;
    &lt;snapshotRepository&gt;
      &lt;id&gt;test-snapshots&lt;/id&gt;
      &lt;name&gt;Snapshots&lt;/name&gt;
      &lt;url&gt;https://nxs.company.com/content/repositories/test-snapshots&lt;/url&gt;
    &lt;/snapshotRepository&gt;
  &lt;/distributionManagement&gt;
  </code></pre>
  
  <p>Doing a <code>mvn deploy</code> (Maven 3.0.3) I get this error:</p>
  
  <pre><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy 
  (default-deploy) on project MyProject: Failed to deploy artifacts: 
  Could not transfer artifact com.company.project:MyProject:jar:1.0.0-20121003.154427-1 
  from/to test-snapshots (https://nxs.company.com/content/repositories/test-snapshots): 
  Access denied to: https://nxs.company.com/content/repositories/test-snapshots/
  com.company.project/MyProject/1.0.0-SNAPSHOT/MyProject-1.0.0-20121003.154427-1.jar
  -&gt; [Help 1]
  </code></pre>
  
  <p>And in my Nexus logfile, I see that no credentials are received, so it will try it later with anonymous and this will of course fail. So why are no credentials passed to Nexus?</p>
  
  <pre><code>2012-10-03 17:24:14 DEBUG [1027496148-8353] - org.apache.shiro.session.mgt.DefaultSessionManager - Unable to resolve session ID from SessionKey [org.apache.shiro.web.session.mgt.WebSessionKey@791a17dc].  Returning null to indicate a session could not be found.
  2012-10-03 17:24:14 DEBUG [1027496148-8353] - org.sonatype.nexus.security.filter.authc.NexusContentAuthenticationFilter - No authorization found (header or request parameter)
  2012-10-03 17:24:14 DEBUG [1027496148-8353] - org.sonatype.nexus.security.filter.authc.NexusContentAuthenticationFilter - No authorization found (header or request parameter)
  2012-10-03 17:24:14 DEBUG [1027496148-8353] - org.sonatype.nexus.security.filter.authc.NexusContentAuthenticationFilter - Attempting to authenticate Subject as Anonymous request...
  2012-10-04 17:24:14 DEBUG [1027496148-8353] - org.sonatype.security.ldap.realms.DefaultLdapContextFactory - Initializing LDAP context using URL [ldap://10.100.100.1:3268/DC=company,DC=com] and username [ldap@company.com] with pooling [enabled]
  </code></pre>