8

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?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Jan Dudek
  • 245
  • 1
  • 5
  • 8

2 Answers2

9

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.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
0

Use the ssh git@ notation.

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

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 04 '23 at 06:58