Maven-scm插件:为什么scmRevision没有按预期工作?

时间:2011-04-14 18:53:57

标签: git maven maven-3 maven-scm

我正在使用Maven 3.0.3,Maven / SCM插件(1.5)和Git 1.7.4.1。我想运行一个maven命令检查git的修订版,但插件正在将我的“scmVersion”参数视为分支名称而不是修订版号。所以,例如,如果我配置

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

(我已经验证上面是有效版本),我收到以下错误。但是,如果我将“scmVersion”更改为分支名称,那么一切都会检查正常。如何配置插件以从修订中签出?谢谢, - 戴夫

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

1 个答案:

答案 0 :(得分:0)

这可能与SCM连接有关,请尝试显式设置connectionType,如下所示:

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

您可以使用命令
验证POM中的URL连接是否有效       mvn scm:validate

正如here解释:

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