gpt4 book ai didi

maven - 如何查看 Maven 在部署期间发送到服务器的内容?

转载 作者:行者123 更新时间:2023-12-03 22:01:08 25 4
gpt4 key购买 nike

我正在尝试使用 Github 的新 Actions CI 服务器将包部署到 Github 的新包功能。进展不顺利。

我认为一切设置正确,但我收到此错误:

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy 
(default-deploy) on project myproject: Failed to deploy artifacts: Could not
find artifact com.mycompany:myproject:pom:1.5 in github
(https://maven.pkg.github.com/mycompany/mycompany_repository) -> [Help 1]

这发生在它似乎成功上传相同的 pom 之后:
Uploading to github: https://maven.pkg.github.com/mycompany/mycompany_repository
/com/mycompany/myproject/1.5/myproject-1.5.pom
Progress (1): myproject-1.5.pom (4.1/6.1 kB)
Progress (1): myproject-1.5.pom (6.1 kB)

所以,在我看来它成功上传了 pom,但几秒钟后它无法下载相同的 pom。

我正在使用调试开关运行部署: mvn -X -e deploy ,但我看不到 Maven 发送到服务器的确切 http 命令。

我该如何调试?是否有一些 Maven/Aether 传输或其他东西可以记录幕后发生的事情?

最佳答案

如果其他人在这里寻找发布到 github 的 OP 问题的解决方案,我有一个类似的问题,发现 settings.xml 和 pom.xml 中所需的 URL 不一致。在您的 settings.xml 中,repo URL 的格式需要为 https://maven.pkg.github.com/myuser/com/mycompany/mypackage ,而在项目的 pom 文件中,它需要采用 https://maven.pkg.github.com/myuser/mypackage 的形式.因此,例如, ~/.m2 中的 settings.xml 文件将如下所示:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">

<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>

<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<repository>
<id>github</id>
<name>GitHub Apache Maven Packages</name>
<url>https://maven.pkg.github.com/myuser/com/mycompany/mypackage</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
</profile>
</profiles>

<servers>
<server>
<id>github</id>
<username>myuser</username>
<password>mypersonalaccesstoken</password>
</server>
</servers>
</settings>

而项目根目录中的 pom.xml 文件需要如下所示:
<project>
...
<groupId>org.mycompany</groupId>
<artifactId>mypackage</artifactId>
<version>1.0.0</version>
...
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Apache Maven Packages</name>
<url>https://maven.pkg.github.com/myuser/mypackage</url>
</repository>
</distributionManagement>
...
</project>

除了这个次要(但至关重要)的细节之外,我的步骤与概述的步骤相同 here .这允许我将我的 Maven 包发布到 github 包注册表。

关于maven - 如何查看 Maven 在部署期间发送到服务器的内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59414112/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com