title: Maven deployment user can deploy, but not read repository
body: <p>The last few days I was trying to set a maven-development environment up. We're using TeamCity for the CI, SonarQube for analysis and SonaType Nexus for the repository management.</p>
  
  <p>TeamCity and SonarQube are working like a charm - The nexus however gives us lots of trouble.</p>
  
  <p>This kind of set up is nothing special, I've done it several times now. This time however, I got a very weird bug: TeamCity is able to deploy artifacts to the nexus, but gives an <code>org.apache.maven.wagon.authorization.AuthorizationException: Not authorized , ReasonPhrase:Unauthorized.</code> error when reading dependencies from the nexus.</p>
  
  <p>I even tried changing the user that TeamCity uses from <code>deployment</code> to <code>admin</code>, same issue. chown returned the correct values as well (owned by the "buildagent" user).</p>
  
  <p>I seriously have no clue what could cause this issue, I already tried reinstalling the nexus 3 times, even added the admin role to the "deployment" user - no change whatsoever.</p>
  
  <p>The settings.xml the "buildagent" user uses has the following content (passwords marked with XXX):</p>
  
  <p></p>
  
  <pre><code>&lt;servers&gt;
      &lt;!-- This is the username password used to access the nexus repository --&gt;
      &lt;server&gt;
           &lt;id&gt;central&lt;/id&gt;
           &lt;username&gt;deployment&lt;/username&gt;
           &lt;password&gt;XXX&lt;/password&gt;
       &lt;/server&gt;
      &lt;server&gt;
           &lt;id&gt;rn-releases&lt;/id&gt;
           &lt;username&gt;deployment&lt;/username&gt;
           &lt;password&gt;XXX&lt;/password&gt;
       &lt;/server&gt;
      &lt;server&gt;
           &lt;id&gt;rn-snapshots&lt;/id&gt;
           &lt;username&gt;deployment&lt;/username&gt;
           &lt;password&gt;XXX&lt;/password&gt;
       &lt;/server&gt;
  &lt;/servers&gt;
  
  &lt;mirrors&gt;
      &lt;mirror&gt;
        &lt;!--This sends everything else to /public --&gt;
        &lt;id&gt;nexus&lt;/id&gt;
        &lt;mirrorOf&gt;central&lt;/mirrorOf&gt;
        &lt;url&gt;http://build.example.com:8301/content/groups/public&lt;/url&gt;
      &lt;/mirror&gt;
  &lt;/mirrors&gt;
  
  &lt;profiles&gt;
      &lt;profile&gt;
          &lt;id&gt;nexus&lt;/id&gt;
          &lt;!--Enable snapshots for the built in central repo to direct --&gt;
          &lt;!--all requests to nexus via the mirror --&gt;
          &lt;repositories&gt;
              &lt;repository&gt;
                  &lt;id&gt;central&lt;/id&gt;
                  &lt;url&gt;http://central&lt;/url&gt;
                  &lt;releases&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/releases&gt;
                  &lt;snapshots&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/snapshots&gt;
              &lt;/repository&gt;
          &lt;/repositories&gt;
          &lt;pluginRepositories&gt;
              &lt;pluginRepository&gt;
                  &lt;id&gt;central&lt;/id&gt;
                  &lt;url&gt;http://central&lt;/url&gt;
                  &lt;releases&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/releases&gt;
                  &lt;snapshots&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/snapshots&gt;
              &lt;/pluginRepository&gt;
          &lt;/pluginRepositories&gt;
      &lt;/profile&gt;
  &lt;/profiles&gt;
  
  &lt;activeProfiles&gt;
      &lt;activeProfile&gt;nexus&lt;/activeProfile&gt;
  &lt;/activeProfiles&gt;
  </code></pre>
  
  <p></p>
  
  <p>For your information: The build log from TeamCity states that the settings are getting read correctly as well, so that's not the cause either.</p>
  
  <p>I really would like to fix this asap, since we have developers waiting to continue on their projects (and we don't want to give out the url if it's not secured, we have private projects running on the CI).</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>Edit:</strong>
  So I now even tried installing artifactory - and I still have the same issue. It seems to be something with either A: Maven or B:TeamCity.</p>