【问题标题】:Azure Artifacts deploy packagesAzure Artifacts 部署包
【发布时间】:2022-01-24 08:11:34
【问题描述】:

我正在尝试使用 mvn deploy:deploy-file 命令将第三方私有包直接发布到我的 Azure Artifacts 源,如下所示:

mvn deploy:deploy-file -Dpackaging="jar" -DrepositoryId="PXXXXX-inccoming" -Durl="https://pkgs.dev.azure.com/XxxXxxxXxxx/XxxXxx/_packaging/PXXXXX-incoming/maven/v1" -DgroupId="pl.group.id" -DartifactId="artifact" -Dversion="0.0.2" -Dfile="C:\path\pl\group\id\0.0.2\artifact-0.0.2.jar"

但我收到奇怪的错误:

[错误] 无法在项目 CAST_2015 上执行目标 org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli):无法部署工件:无法传输工件 pl.group .id:artifact:jar:0.0.2 from/to PXXXXX-inccoming (https://pkgs.dev.azure.com/XxxXxxxXxxx/XxxXxx/_packaging/PXXXXX-incoming/maven/v1): Transfer failed for https://pkgs.dev.azure.com/XxxXxxxXxxx/XxxXxx/_packaging/PXXXXX-incoming/maven/v1/pl/group/id/artifact/0.0.2/artifact-0.0.2.jar 401 Unauthorized ProxyInfo{host='proxy-host', userName='null', port=8080, type='http', nonProxyHosts='null'}

提供的用户具有在 Azure 中打包的完全访问权限。

代理和服务器设置实际上都在我的 setting.xml 文件中。 我做错了什么?

【问题讨论】:

  • 代理配置/凭证错误:401 Unauthorized ProxyInfo{host='proxy-host',

标签: java maven azure-devops azure-artifacts


【解决方案1】:

Azure Artifacts 部署包

当我们收到 401 时,这是因为 maven 发送了错误的登录凭据,或者根本没有凭据。

若要解决此问题,请在maven设置配置文件的<servers>...</servers>配置节点添加如下配置:

<server>
      <id>releases</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
    <server>
      <id>snapshots</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
  </servers>

注意:

  • setting.xml中配置的id必须和id一致 在 pom.xml 中配置。
  • 如果您尝试将某些内容发布到发布存储库并且 版本库中已存在版本

如果它不适合你,请查看下面的线程以获取更多详细信息:

Why am I getting a "401 Unauthorized" error in Maven?

【讨论】:

    猜你喜欢
    • 2021-04-26
    • 1970-01-01
    • 2020-11-06
    • 1970-01-01
    • 2017-02-19
    • 2021-01-05
    • 2019-11-08
    • 2021-07-10
    • 1970-01-01
    相关资源
    最近更新 更多