maven - 在 Maven 中为多个存储库设置单个服务器凭据

标签 maven credentials nexus

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

我们使用 Maven 3.0.4 将 Artifact 部署到 Nexus pro 版本 2.2.1

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

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

<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 中的所有四个条目。文件

有没有办法为所有存储库声明一次凭据?

谢谢,
艾尔

最佳答案

是的,至少我相信这应该有效。

代替

<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。

关于maven - 在 Maven 中为多个存储库设置单个服务器凭据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17511469/

相关文章:

由于 java.net.UnknownHostException,Maven 元数据插件无法获取 maven-metadata.xml

java - 运行maven时如何避免此错误 No such file or directory

java - 设置 OpenCMIS InMemory 存储库

java - 无法使用另一个本地依赖模块中的接口(interface)或类

maven - 配置 CXF 代码生成插件

api - 如何启用 REST API 直接信用卡付款的实时凭证

spring - setenv.sh 在 Tomcat 中到底有什么用?

maven - Nexus Artefact 上传失败

maven nexus 下载中央远程索引错误

c# - 如何用 C# 将图像发布到 Twitter