Java 尝试将Maven构建JAR部署到github包注册表时发生异常
我正在尝试将Maven构建JAR部署到Github包注册表 执行Java 尝试将Maven构建JAR部署到github包注册表时发生异常,java,maven,github,github-package-registry,Java,Maven,Github,Github Package Registry,我正在尝试将Maven构建JAR部署到Github包注册表 执行mvn deploy命令时出现异常 我正在使用一个简单的Maven项目,我想创建一个组件JAR并存储在Github包注册表中 构建成功了,我现在想将这个工件部署到注册表 我在~./m2/settings.xml中添加了以下内容 在profile中的repositories下添加了repository元素 <repository> <id>github</id>
mvn deploy
命令时出现异常
我正在使用一个简单的Maven项目,我想创建一个组件JAR并存储在Github包注册表中
构建成功了,我现在想将这个工件部署到注册表
我在~./m2/settings.xml
中添加了以下内容
在profile
中的repositories
下添加了repository
元素
<repository>
<id>github</id>
<name>GitHub OWNER Apache Maven Packages</name>
<url>https://maven.pkg.github.com/swastikaa-in</url>
</repository>
<servers>
<server>
<id>github</id>
<username>swastikaa</username>
<password>my personal token from github</password>
</server>
</servers>
预期的:
若要成功部署,构建工件将部署到Github包注册表
实际值:
例外情况如下:
Caused by: org.eclipse.aether.transfer.MetadataTransferException:
Could not transfer metadata com.redjohn.tools:math:0.0.2-SNAPSHOT/maven-metadata.xml
from/to github (https://maven.pkg.github.com/swastikaa-in/math):
Failed to transfer file https://maven.pkg.github.com/swastikaa-in/math/com/redjohn/tools/math/0.0.2-SNAPSHOT/maven-metadata.xml
with status code 400
Caused by: org.apache.maven.wagon.TransferFailedException:
Failed to transfer file https://maven.pkg.github.com/swastikaa-in/math/com/redjohn/tools/math/0.0.2-SNAPSHOT/maven-metadata.xml
with status code 400
有人能帮我解决这个问题吗
我已按照以下链接中提供的说明进行操作:
我也遇到了同样的问题,我发现快照版本不能正常工作。如果部署了非快照版本,它应该可以工作。在
settings.xml
文件中,https://maven.pkg.github.com/OWNER/REPOSITORY
您需要使用将所有者
替换为您的github用户名
并将存储库
替换为您在github中的项目存储库的名称。请在您的令牌中列出权限。您可能缺少与包相关的权限。我收到了相同的错误@拉萨古拉,你找到解决办法了吗。Thanksnapshot版本不起作用。部署工作正常,但无法下载人工制品。
Caused by: org.eclipse.aether.transfer.MetadataTransferException:
Could not transfer metadata com.redjohn.tools:math:0.0.2-SNAPSHOT/maven-metadata.xml
from/to github (https://maven.pkg.github.com/swastikaa-in/math):
Failed to transfer file https://maven.pkg.github.com/swastikaa-in/math/com/redjohn/tools/math/0.0.2-SNAPSHOT/maven-metadata.xml
with status code 400
Caused by: org.apache.maven.wagon.TransferFailedException:
Failed to transfer file https://maven.pkg.github.com/swastikaa-in/math/com/redjohn/tools/math/0.0.2-SNAPSHOT/maven-metadata.xml
with status code 400