在Maven中为多个存储库设置单个服务器凭据 [英] Setting a single server credentials in Maven for multiple repositories

查看:111
本文介绍了在Maven中为多个存储库设置单个服务器凭据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在Maven settings.xml中使用单个服务器凭据获得多个存储库吗?

Can I have multiple repositories in Maven settings.xml with a single server credentials?

我们正在使用Maven 3.0.4将工件部署到Nexus Pro 2.2.1版

We're using Maven 3.0.4 to deploy artifacts to Nexus pro version 2.2.1

我们在同一服务器上有多个存储库,并且用户使用相同的凭据来访问所有这些存储库.

We have multiple repositories on the same server, and a user uses the same credentials to access all these repositories.

settings.xml具有相同凭据的多个存储库:

The settings.xml multiple repositories with the same credentials:

<repositories>
<repository>
   <id>Staging-group</id>
   <url>http://server/nexus/content/groups/Staging-group</url>
<repository>
   <id>RELEASES</id>
   <url>http://server/nexus/content/repositories/RELEASES</url>
</repository>
<repository>
   <id>INTERNALS</id>
   <url>http://server/nexus/content/repositories/INTERNALS</url>
</repository>
<repository>
   <id>SNAPSHOTS</id>
   <url>http://server/nexus/content/repositories/SNAPSHOTS</url>
</repository>
</repositories>
.....
<servers>
<server>
   <id>Staging-group</id>
   <username>user</username>
   <password>password</password>
</server>
<server>
   <id>RELEASES</id>
   <username>user</username>
   <password>password</password>
</server>
<server>
   <id>SNAPSHOTS</id>
   <username>user</username>
   <password>password</password>
</server>
<server>
   <id>INTERNALS</id>
   <username>user</username>
   <password>password</password>
</server>
</servers>

Nexus使用Active Directory身份验证.因此,每次用户更改Windows密码时,他们都需要更改settings.xml文件中的所有四个条目

Nexus uses Active Directory authentication. So every time a user changes his or her Windows password, they need to change all four entries in the settings.xml file

是否有一种方法可以对所有存储库一次声明凭据?

Is there a way to declare the credentials once for all the repositories?

谢谢, 没事

推荐答案

是的,至少我认为这应该可行.

Yes, at least I believe this should work.

代替

<repository>
   <id>SNAPSHOTS</id>
   <url>http://server/nexus/content/repositories/SNAPSHOTS</url>
</repository>

使用

<repository>
  <id>nexus</id>
  <name>SNAPSHOTS</name>
  <url>http://server/nexus/content/repositories/SNAPSHOTS</url>
</repository>

然后仅将nexus用作您的服务器ID.

Then just reference nexus as your server id.

这篇关于在Maven中为多个存储库设置单个服务器凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆