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

Syntax of the pom.xml scm connection string

我正在清理项目中的 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:git@github.com:jadler-mocking/jadler.git</connection>
    <developerConnection>scm:git:git@github.com:jadler-mocking/jadler.git</developerConnection>
    <url>https://github.com/jadler-mocking/jadler</url>
</scm>

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

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

来自 the Maven SCM Git implementation,所有这些 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 信息是否正确:

Validate scm connection string.

SCM 连接字符串的参考格式可以在 the Maven docs:

中找到

All SCM connections are made through a common URL structure.

scm:[provider]:[provider_specific]

Where provider is the type of SCM system.