如何查看在部署过程中Maven向服务器发送了什么? [英] How to see what Maven is sending to a server during deploy?
问题描述
我正在尝试使用Github的新Actions CI服务器将程序包部署到Github的新程序包功能.进行得不好.
I'm trying to use Github's new Actions CI server to deploy packages to Github's new packages feature. It's not going well.
我认为所有设置都正确,但出现此错误:
I think it's all set up correctly, but I get this error:
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:
This happens after it appears to upload that same pom successfully:
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.
So, it looks to me like it is successfully uploading the pom, but then it fails to download the same pom a few seconds later.
我正在使用以下调试开关运行部署:mvn -X -e deploy
,但是我看不到Maven发送到服务器的确切http命令.
I'm running the deploy with debug switches on: mvn -X -e deploy
, but I can't see the exact http commands that Maven is sending to the server.
我该如何调试?是否有一些Maven/Aether传输或某些可以记录幕后运行情况的东西?
How do I debug this? Is there some Maven/Aether transport or something that will log what is going on under the covers?
推荐答案
如果有人在这里寻找OP的解决方案,则将问题发布到github,我遇到了类似的问题,发现settings.xml和pom.xml不一致.在您的settings.xml中,回购URL的格式应为 https://maven.pkg.github.com/myuser/com/mycompany/mypackage ,而在您项目的pom文件中,该文件的格式必须为
In case anyone else lands here looking for a solution to OPs issue publishing to github, I had a similar issue and found that the URLs needed in settings.xml and pom.xml are inconsistent. In your settings.xml, the repo URL needs to be of the form https://maven.pkg.github.com/myuser/com/mycompany/mypackage, whereas in your project's pom file, it needs to be of the form https://maven.pkg.github.com/myuser/mypackage. So, for example, your settings.xml file in ~/.m2 would look something like this:
<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文件应如下所示:
Whereas the pom.xml file in the root of your project would need to look like this:
<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>
Other than this minor (but crucial) detail, my steps were the same as those outlined here. This allowed me to publish my Maven package to github package registry.
这篇关于如何查看在部署过程中Maven向服务器发送了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!