5

我正在清理项目中的 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>

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

4

1 回答 1

7

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

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 信息是否正确scm:validate

验证 scm 连接字符串。

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

所有 SCM 连接都是通过一个通用的 URL 结构进行的。

scm:[provider]:[provider_specific]

其中 provider 是 SCM 系统的类型。

于 2016-02-27T23:19:02.723 回答