Maven-scm plugin: Why does scmRevision not work as expected?

I am using Maven 3.0.3, the Maven / SCM plugin (1.5) and Git 1.7.4.1. I want to run the maven command to check the git revision, but the plugin treats my "scmVersion" parameter as the branch name and not the revision number. So for example, if I configure

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-scm-plugin</artifactId> <version>1.5</version> <configuration> <goals>install</goals> <username>username</username> <password>password</password> <scmVersion>ccaa6881dd1a9312ad44e39eea719f33ec3e8124</scmVersion> <scmVersionType>revision</scmVersionType> </configuration> </plugin> 

(where I checked that the above is a valid version), I get the error below. However, if I change "scmVersion" to the branch name, then everything will be perfectly checked. How to configure a plugin for verification from a revision? Thanks - Dave

 davea-mbp2:socialmediaproxy davea$ mvn scm:checkout [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building socialmediaproxy 0.1 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-scm-plugin:1.5:checkout (default-cli) @ socialmediaproxy --- [INFO] Removing /Users/davea/Documents/workspace-sts-2.6.0.SR1/socialmediaproxy/target/checkout [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ … [INFO] --- maven-scm-plugin:1.5:checkout (default-cli) @ socialmediaproxy --- [INFO] Removing /Users/davea/Documents/workspace-sts-2.6.0.SR1/socialmediaproxy/target/checkout [INFO] Executing: /bin/sh -c cd /Users/davea/Documents/workspace-sts-2.6.0.SR1/socialmediaproxy/target && git clone http://maven: Nohw5ohr@chi-git.mydomain.com /socialmediaproxy.git /Users/davea/Documents/workspace-sts-2.6.0.SR1/socialmediaproxy/target/checkout [INFO] Working directory: /Users/davea/Documents/workspace-sts-2.6.0.SR1/socialmediaproxy/target [INFO] Executing: /bin/sh -c cd /Users/davea/Documents/workspace-sts-2.6.0.SR1/socialmediaproxy/target/checkout && git pull http://maven: Nohw5ohr@chi-git.mydomain.com /socialmediaproxy.gitccaa6881dd1a9312ad44e39eea719f33ec3e8124:ccaa6881dd1a9312ad44e39eea719f33ec3e8124 [INFO] Working directory: /Users/davea/Documents/workspace-sts-2.6.0.SR1/socialmediaproxy/target/checkout [ERROR] Provider message: [ERROR] The git-pull command failed. [ERROR] Command output: [ERROR] fatal: Couldn't find remote ref ccaa6881dd1a9312ad44e39eea719f33ec3e8124 
+4
source share
1 answer

There is probably a problem with the SCM connection, try setting the connectionType explicitly as follows:

  <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-scm-plugin</artifactId> <version>1.5</version> <configuration> <connectionType>developerConnection</connectionType> </configuration> </plugin> 

You can check if URL connections in POM are valid using the command
mvn scm:validate

As explained here :

mvn -DscmConnection="<scm url>" -DscmDeveloperConnection="<scm url>" scm:validate

0
source

Source: https://habr.com/ru/post/1348157/


All Articles