我正在尝试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:packages
和write: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]
我要去哪里错了?
所以我认为您看到这的原因是因为您错过了将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文件无法上传的错误,但该包仍在发布中]]