15

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

[错误] 无法在项目 hello-world-service-minimal 上执行目标 org.apache.maven.plugins:maven-scm-plugin:1.9:tag (default-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>

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

4

1 回答 1

27

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

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

于 2014-03-25T04:15:53.213 回答