基础设施 - Maven + Nexus

时间:2012-05-16 18:08:32

标签: maven active-directory nexus

我安装了一个sonatype nexus作为我的maven repo。 nexus instalation正在使用Active Directory对用户进行身份验证,并且匿名登录已关闭。

每个将工件上传到我的仓库的用户都必须使用唯一的用户名进行识别,从而进行AD集成。

使用此结构的常规方法是在POM.xml分发管理标记中设置,以便将工件发送到nexus

 <distributionManagement>
    ...
    <repository>
      <id>deploymentRepo</id>
      <name>Internal Releases</name>
      <url>http://nexusserver:8081/nexus/content/repositories/releases</url>
    </repository>
    ...
  </distributionManagement>

在本地仓库设置(~/.m2/settings.xml)中添加用户名/密码组合以登录nexus

<server>
  <id>deploymentRepo</id>
  <username>deployment</username>
  <password>deployment123</password>
 </server>

它对我很有用,但我想要实现的是以某种方式在nexus中执行auth而无需将用户密码放在本地存储库中。有可能吗?

2 个答案:

答案 0 :(得分:0)

您想要实现的目标:不是将密码存储为纯文本,也不是每次运行maven deploy命令时都必须传递密码的用户?

密码可以加密形式存储,如here

所述

或者您可以尝试在命令行上传递密码,如下所示,但我没有尝试过:

mnv -Dpassword=deployment123 deploy

答案 1 :(得分:0)

Nexus 2.1将于6月发布,我们已经构建了一项新功能来支持安全身份验证,而无需在settings.xml中使用明文密码。