Sonatype Nexus: How to set a single server credentials for multiple repositories in maven's settings.xml?

后端 未结 3 1615
旧巷少年郎
旧巷少年郎 2021-02-06 06:08

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 repositori

3条回答
  •  没有蜡笔的小新
    2021-02-06 06:44

    Not a solution but a workaround:

    settings.xml will handle system properties and environment variables. So if you're not fussed about putting your server authentication details in a script or in your environment, you can stick with three server credentials but eliminate the need to update all three of them in favour of updating your script or environments (I've put examples for both options in this snippet):

    
      
        releases
        ${env.NEXUS_USERNAME} 
        ${nexus.password} 
      
      
        snapshots
        ${env.NEXUS_USERNAME} 
        ${nexus.password} 
      
      
        site
        ${env.NEXUS_USERNAME} 
        ${nexus.password} 
      
    
    

    Unfortunately there's no element supported in settings.xml!

    Aside: maven already handles the snapshots and releases repositories within nexus, and that is the better way to do things. Your posted settings.xml even enables them already. Why do you need separate repository entries for snapshots and releases?

提交回复
热议问题