17

I'm having a problem using the Maven SCM plugin with Git. I cannot get the plugin to work at all because it says the provider is not found. It gives me the following error when I run mvn scm:tag:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-scm-plugin:1.9:tag (default-cli) on project hello-world-service-minimal: Cannot run tag command : Can't load the scm provider. No such provider: 'git:ssh://git@git-eng.REDACTED.com' . -> [Help 1]

My pom.xml looks like the following:

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

Anyone have any idea how to fix this? This is driving me crazy. I can't figure out what I am doing wrong at all.

Philip Lombardi
  • 1,276
  • 2
  • 17
  • 26

1 Answers1

28

The <url> tag is for a regular browsable URL. You need a <connection> tag (<connection> is for read access, <developerConnection> is for write access):

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

See the Maven POM Reference for more information.

Adam Batkin
  • 51,711
  • 9
  • 123
  • 115
  • 1
    Also, I'm not sure what's going on with the pipes (`|`), perhaps those should be slashes (`/`)? – Adam Batkin Mar 25 '14 at 04:20
  • 1
    It still doesn't work with the tag. The pipe is because of the documentation here: http://maven.apache.org/scm/git.html that says to substitute : with | ... Git-Lab uses a : before the first slash. – Philip Lombardi Mar 25 '14 at 04:22
  • 5
    Pipe is only to replace a colon, if an SCM path contains, for example, a Windows drive letter, because the git plugin assumes that after the colon is a TCP port. Replace with a slash, and see if you get the *same* error or if it's different from the error above. – Adam Batkin Mar 25 '14 at 04:25
  • 1
    That did it! Wow. Thank you so much. That has been driving me nuts all evening. – Philip Lombardi Mar 25 '14 at 04:34
  • 2
    For gitlab - take NOTE of the "replace with a slash" as stated by Adam Batkin above. Replacing with pipe resulted in "SCM provider not found" errors for me. A slash got me working more or less – demaniak Oct 06 '15 at 11:55