Maven-scm plugin: Why is the scmRevision not working as expected?

I’m using Maven 3.0.3, the Maven/SCM plugin (1.5) and Git 1.7.4.1. I want to run a maven command to check out a revision of git, but the plugin is treating my “scmVersion” parameter like a branch name instead of a 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 have verified that the above is a valid revision), I get the error below. However, if I change “scmVersion” to be a branch name, then everything checks out fine. How do I configure the plugin to checkout from a revision? Thanks, – Dave

  • Storing git commit metadata in TFS when using git-tfs
  • git push branch to a new repo with a different name
  • Removing a directory from .gitignore so git starts to track changes in it
  • Can you use EGit for free?
  • Start tracking branches/tags on a git-svn repo that was tracking only trunk
  • how to reset develop branch to master
  • 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
    

  • Jenkins loses workspaces periodically, triggers unwanted build
  • Standard to follow when writing git commit messages
  • Git 1.7.11 Debian fatal: Unable to find remote helper for 'https'
  • Freezing a Git branch
  • git - revert update-index/ignored file so I can change branch?
  • git: how to have per project configuration?
  • One Solution collect form web for “Maven-scm plugin: Why is the scmRevision not working as expected?”

    It’s probably problem with SCM connection, try to explicitly set connectionType like this:

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

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

    As it is explained here :

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

    Git Baby is a git and github fan, let's start git clone.