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

Jan*_*dek 5 github pom.xml maven-scm maven

我正在清理项目中的 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>
Run Code Online (Sandbox Code Playgroud)

对比

<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>
Run Code Online (Sandbox Code Playgroud)

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

Tun*_*aki 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
Run Code Online (Sandbox Code Playgroud)

请注意,您可以在scm:validate目标的帮助下验证您的 SCM 信息是否正确:

验证 scm 连接字符串。

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

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

scm:[provider]:[provider_specific]
Run Code Online (Sandbox Code Playgroud)

其中 provider 是 SCM 系统的类型。