title: Sonatype Nexus: How to set a single server credentials for multiple repositories in maven's settings.xml?
body: <p>We have multiple repositories in Nexus (i.e., releases, snapshot and site). All 3 repos are under public group and users uses the same credentials to access all these repositories. Providing the same username and password in settings.xml for each repository makes it redundant and hard to maintain them.</p>
  
  <p>Could you please suggest an elegant way to describe one server credential for all the 3 repositories? </p>
  
  <p>Any help is greatly appreciated.</p>
  
  <p>We are using maven 2.2.1 and Nexus OSS 2.7.1</p>
  
  <p><strong>Here is my settings.xml</strong></p>
  
  <pre><code>&lt;settings&gt;    
  &lt;servers&gt;   
  &lt;server&gt;   
      &lt;id&gt;snapshot&lt;/id&gt;   
      &lt;username&gt;deployment&lt;/username&gt;   
      &lt;password&gt;deployment123&lt;/password&gt;      
  &lt;/server&gt;  
  &lt;server&gt;   
         &lt;id&gt;release&lt;/id&gt;   
         &lt;username&gt;deployment&lt;/username&gt;  
         &lt;password&gt;deployment123&lt;/password&gt;      
  &lt;/server&gt;  
  &lt;server&gt;  
        &lt;id&gt;site&lt;/id&gt;  
        &lt;username&gt;deployment&lt;/username&gt;  
        &lt;password&gt;deployment123&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;*&lt;/mirrorOf&gt;  
        &lt;url&gt;http://localhost:8081/nexus/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;!--make the profile active all the time --&gt;  
      &lt;activeProfile&gt;nexus&lt;/activeProfile&gt;  
    &lt;/activeProfiles&gt;  
  &lt;/settings&gt;  
  </code></pre>