无法使用GitHub软件包(beta)发布maven依赖项

问题描述 投票:0回答:1

我正在尝试GitHub packages beta,我有一个要发布的Maven项目。在POM.xml中,我确实在tag下添加了。test-package是我的repository名称。

    <repository>
        <id>github</id>
        <name>GitHub amarkum Apache Maven Packages</name>
        <url>https://maven.pkg.github.com/amarkum/test-package</url>
    </repository>
</distributionManagement>

我在~/.m2/setting.xml中已正确配置了访问令牌。

当我运行mvn deploy命令时,它无法发布程序包。我也尝试过手动提供令牌

mvn deploy -Dregistry=https://maven.pkg.github.com/amarkum -Dtoken=<MY_TOKEN_GENERATED>

我生成的令牌具有所有特权,除了read:packageswrite:packages范围

错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project test-package: Failed to retrieve remote metadata com.codefolx.test:test-package:1.0-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.codefolx.test:test-package:1.0-SNAPSHOT/maven-metadata.xml from/to github (https://maven.pkg.github.com/amarkum/test-package): Not authorized , ReasonPhrase:Unauthorized. -> [Help 1]

我要去哪里错了?

maven github pom.xml github-package-registry
1个回答
0
投票

所以我认为您看到这的原因是因为您错过了将github配置文件添加到您的maven设置的步骤:https://help.github.com/en/articles/configuring-apache-maven-for-use-with-github-package-registry#authenticating-to-github-package-registry

即使完成此操作后,我有时仍然会看到有关maven-metadata.xml文件无法上传的错误,但该包仍在发布中]]

© www.soinside.com 2019 - 2024. All rights reserved.