mavengithubpom.xmlmaven-scm

Syntax of the pom.xml scm connection string


I'm cleaning up pom files in my project and find out I use two slightly different scm records:

<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>

vs

<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>

I haven't been able to find any resource describing the syntax of the connection strings so far. What is the difference between these two?


Solution

  • Both are valid SCM URLs and they will have exactly the same result. The only difference will be in the implementation of the communication with the Git server (is it HTTPS or HTTP etc.).

    From the Maven SCM Git implementation, all those URLs are valid:

    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
    

    Note that you can validate that your SCM information is correct with the help of the scm:validate goal:

    Validate scm connection string.

    The reference format for the SCM connection string can be found in 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.