When using the maven-release plugin, why not just discover the scm information from the local repo?

As far as I know, to use the maven-release plugin module, you need to go to the scm section in your POM file. For instance:.

<scm> <connection>scm:hg:ssh:// hg@bitbucket.org /my_account/my_project</connection> <developerConnection>scm:hg:ssh:// hg@bitbucket.org /my_account/my_project</developerConnection> <url>ssh:// hg@bitbucket.org /my_account/my_project</url> <tag>HEAD</tag> </scm> 

I understand that this data is used to determine what needs to be marked and where to push the changes. But is this information already unavailable if you have a cloned / verified code? I'm struggling a bit with the concept that I need to tell maven what code he needs to tag when possible, at least in theory, just ask Git / HG / SVN / CVS what code he is dealing with. I suspect something is missing in the details, but I'm not sure what. Is it possible to modify the maven-release-plugin module code to remove this as a requirement, or at least do auto-discovery by default? If someone could not point out some context on why this would not work?

+4
source share
1 answer

On the one hand, GIT and Subversion can have different SCM URIs for read and write access.

This is what is supposed to be used for different URIs <connection> and <developerConnection> . The first is the URI, guaranteed read access. The second is the URI, guaranteed write access.

Very often, canonical URIs cannot be inferred from an unloaded repository.

For example, I can check the Subversion repository internally through the svn: protocol and the IP address of the server, but external participants should use https:// with the host name.

Or even with GIT repositories, on Github you have different URIs for different access mechanisms, for example

  • https://github.com/stephenc/eaio-uuid.git (read / write using Username / Password or OAuth)
  • git@github.com :stephenc/eaio-uuid.git (read and write using the SSH private key)
  • git://github.com/stephenc/eaio-uuid.git (anonymous read only)

Do not pay attention to the fact that you may have checked git://github.com/zznate/eaio-uuid.git or cloned a local check, in other words, your local GIT repository may have the value "upstream" ../eaio-uuid-from-nate , not git@github.com :stephenc/eaio-uuid.git

I agree that for some SCM tools you can automatically detect ... for example, if you know that the source is derived from, for example. AccuRev, you should be fine in accepting your data ... until you remove the Subversion module or GIT or CVS or etc code into the AccuRev workspace (true story) so that the tag that was retracted can be updated.

So, the discovery code must be sure that you did not use two SCM systems at the same time to make sure that it is the main SCM ... and the other SCM may not even leave the marker files on the disk to sniff out (AccuRev, for example, does not ... hence why I chose it)

The only safe way is to require pom to define at least the SCM system and for those SCM systems where the URI cannot be reliably inferred (I think CVS, Subversion, GIT, HG, in fact most of them) require a URI .

+2
source

All Articles