pom.xml scm 连接字符串的语法

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

我正在清理项目中的 pom 文件,发现我使用了两个略有不同的 scm 记录:

<scm>
    <connection>scm:git:https://github.com/jadler-mocking/jadler.git</connection>
    <developerConnection>scm:git:https://github.com/jadler-mocking/jadler.git</developerConnection>
    <url>https://github.com/jadler-mocking/jadler</url>
</scm>

<scm>
    <connection>scm:git:[email protected]:jadler-mocking/jadler.git</connection>
    <developerConnection>scm:git:[email protected]:jadler-mocking/jadler.git</developerConnection>
    <url>https://github.com/jadler-mocking/jadler</url>
</scm>

到目前为止,我还没有找到任何描述连接字符串语法的资源。这两者有什么区别?

maven github pom.xml maven-scm
2个回答
8
投票

两者都是有效的 SCM URL,并且它们将具有完全相同的结果。唯一的区别在于与 Git 服务器通信的实现方式(是 HTTPS 还是 HTTP 等)。

Maven SCM Git 实现来看,所有这些 URL 都是有效的:

scm:git:git://server_name[:port]/path_to_repository
scm:git:http://server_name[:port]/path_to_repository
scm:git:https://server_name[:port]/path_to_repository
scm:git:ssh://server_name[:port]/path_to_repository
scm:git:file://[hostname]/path_to_repository

请注意,您可以借助

scm:validate
目标来验证您的 SCM 信息是否正确:

验证 scm 连接字符串。

SCM 连接字符串的参考格式可以在 Maven 文档中找到:

所有 SCM 连接均通过通用 URL 结构进行。

scm:[provider]:[provider_specific]

其中provider是SCM系统的类型。


0
投票

使用 ssh git@ 表示法。

Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project parent: Unable to tag SCM
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] remote: Support for password authentication was removed on August 13, 2021.
[ERROR] remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
[ERROR] fatal: Authentication failed for 'https://github.com/warrenc5/slee-annotations.git/'
[ERROR]

https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls

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