连接到sonatype nexus时如何传递凭据(禁用匿名登录)?

Jac*_*ine 4 java command-line maven-2 nexus sonatype

在eclipse中,m2eclipse插件会在我构建maven2项目时提示我输入凭据.它编译得很好.

但是,如果我现在尝试从命令行运行"mvn install",我会收到一个找不到工件的错误.如何将用户名/密码添加到我的pom.xml中以解决此问题.

Bhu*_*ale 6

你在说什么用户名密码?如果它是在nexus存储库中定义的用户名,那么您可以在settings.xml您定义nexus存储库的位置定义.

<servers>
  <server>
    <id>releases</id>
    <username>xxxxxxxxx</username>
    <password>yyyyyyyy</password>
  </server>
</servers>
Run Code Online (Sandbox Code Playgroud)

  • 是的,它也适用于检索工件.id属性中的值应与为nexus存储库定义的镜像ID值相匹配. (2认同)