【问题标题】:Maven SCM Plugin: Git SSH provider not foundMaven SCM 插件:未找到 Git SSH 提供程序
【发布时间】:2014-05-02 17:56:52
【问题描述】:

我在使用带有 Git 的 Maven SCM 插件时遇到问题。我根本无法让插件工作,因为它说找不到提供程序。当我运行mvn scm:tag 时,它给了我以下错误:

[ERROR] 无法执行目标 org.apache.maven.plugins:maven-scm-plugin:1.9:tag 项目 hello-world-service-minimal 上的(默认 cli):无法运行标记命令: 无法加载 scm 提供程序。没有这样的提供者:'git:ssh://git@git-eng.REDACTED.com' . -> [帮助 1]

我的 pom.xml 如下所示:

<project>
  <modelVersion>4.0.0</modelVersion>

  <groupId>net.REDACTED</groupId>
  <artifactId>hello-world-service-minimal</artifactId>
  <version>1.0.13</version>
  <packaging>pom</packaging>

  <name>hello-world-service</name>

  <properties>
     <lang.java.source>1.7</lang.java.source>
     <lang.java.target>1.7</lang.java.target>

    <dep.junit>4.11</dep.junit>
  </properties>

  <scm>
     <developerConnection>scm:git:ssh://git@git-eng.REDACTED.com|PROJECT_NAME/hello-world-service-minimal.git</developerConnection>
     <url>scm:git:http://git-eng.REDACTED.com/PROJECT_NAME/hello-world-service-minimal/tree/master</url>
  </scm>

  <distributionManagement>
     <repository>
        <id>dev.release</id>
        <url>file:${project.build.directory}/repository/</url>
     </repository>
  </distributionManagement>

  <build>
      <plugins>
          <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>versions-maven-plugin</artifactId>
              <version>2.1</version>
          </plugin>
          <plugin>
              <artifactId>maven-scm-plugin</artifactId>
              <version>1.9</version>
              <configuration>
                  <tag>${project.artifactId}-${project.version}</tag>
              </configuration>
          </plugin>
      </plugins>
  </build>
</project>

有人知道如何解决这个问题吗?这真让我抓狂。我根本不知道我做错了什么。

【问题讨论】:

    标签: maven maven-scm


    【解决方案1】:

    &lt;url&gt; 标记用于常规可浏览 URL。您需要一个&lt;connection&gt; 标签(&lt;connection&gt; 用于读取访问,&lt;developerConnection&gt; 用于写入访问):

    <scm>
      <connection>scm:git:ssh://git@git-eng.REDACTED.com|PROJECT_NAME/hello-world-service-minimal.git</connection>
      <developerConnection>scm:git:ssh://git@git-eng.REDACTED.com|PROJECT_NAME/hello-world-service-minimal.git</developerConnection>
      <url>http://git-eng.REDACTED.com/PROJECT_NAME/hello-world-service-minimal/tree/master</url>
    </scm>
    

    请参阅Maven POM Reference 了解更多信息。

    【讨论】:

    • 另外,我不确定管道是怎么回事 (|),也许那些应该是斜线 (/)?
    • 它仍然不适用于 标签。管道是因为这里的文档:maven.apache.org/scm/git.html 说要替换 : with | ... Git-Lab 在第一个斜杠之前使用 :
    • 管道仅用于替换冒号,如果 SCM 路径包含例如 Windows 驱动器号,因为 git 插件假定冒号后面是 TCP 端口。用斜线替换,看看你是否得到 same 错误或者它是否与上面的错误不同。
    • 做到了!哇。太感谢了。这让我整个晚上都发疯了。
    • 对于 gitlab - 请注意上面 Adam Batkin 所说的“用斜线替换”。替换为管道导致我出现“未找到 SCM 提供程序”错误。斜线让我或多或少地工作
    猜你喜欢
    • 2015-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多