Question

I am trying to use the maven release plugin to create a released version of a Java project having Perforce as the SCM.

My pom scm section is:

<scm>
  <connection>scm:p4:myperforcehostname:1666://mydepot/mycomponent</connection>
  <developerConnection>scm:p4:myperforcehostname:1666://mydepot/mycomponent</developerConnection>
  <url>http://myperforcehostname:1666</url>
</scm>

Also I use the P4Maven plugin and the Maven Release Plugin:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-scm-plugin</artifactId>
  <version>1.4</version>
  <dependencies>
    <dependency>
      <groupId>com.perforce</groupId>
      <artifactId>p4maven</artifactId>
      <version>[2011,2012)</version>
    </dependency>
  </dependencies>
  <configuration>
    <connectionType>connection</connectionType>
    <username>myusernme</username>
    <password>mypassword</password>
    <includes>**</includes>
  </configuration>
</plugin>        
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-release-plugin</artifactId>
  <version>2.5</version>
</plugin>

When calling 'mvn release:prepare -DdryRun=true' I get

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:prepare 
(default-cli) on project mycomponent: The provider given in the SCM URL could not be found: 
No such provider: 'p4'. -> [Help 1]

Any ideas?

I am able to call mvn scm:checkout.

Was it helpful?

Solution 2

It turned out that P4Maven comes not out of the box. I had to download it from the Perforce pages and install it into my repository (following the instructions in the download zip file). After that I could successfully use p4 as the SCM provider.

OTHER TIPS

You need to add the p4maven as dependency to the maven-scm-plugin as well as to the maven-release-plugin.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-scm-plugin</artifactId>
  <version>1.4</version>
  <dependencies>
    <dependency>
      <groupId>com.perforce</groupId>
      <artifactId>p4maven</artifactId>
      <version>[2011,2012)</version>
    </dependency>
  </dependencies>
  <configuration>
    <connectionType>connection</connectionType>
    <username>username</username>
    <password>password</password>
    <includes>**</includes>
  </configuration>
</plugin>        
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-release-plugin</artifactId>
  <version>2.5</version>
  <dependencies>
    <!-- P4Maven -->
    <dependency>
      <groupId>com.perforce</groupId>
      <artifactId>p4maven</artifactId>
      <version>[2011,2012)</version>
    </dependency>
  </dependencies>
  <configuration>
    <connectionType>connection</connectionType>
    <username>username</username>
    <password>password</password>
    <includes>**</includes>
  </configuration>
</plugin>

Here I done recently:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-scm-plugin</artifactId>
            <version>1.9.4</version>
            <dependencies>
                <dependency>
                    <groupId>com.perforce.p4maven</groupId>
                    <artifactId>p4maven-provider</artifactId>
                    <version>1.0.6</version>
                </dependency>
            </dependencies>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.5.3</version>
            <dependencies>
                <dependency>
                    <groupId>com.perforce.p4maven</groupId>
                    <artifactId>p4maven-provider</artifactId>
                    <version>1.0.6</version>
                </dependency>
            </dependencies>
        </plugin>

And then some useful commands:

mvn scm:changelog -Dusername=yourP4user -Dpassword=yourP4pwd
release:prepare -Dusername=yourP4user -Dpassword=yourP4pwd -autoVersionSubmodules=true -DignoreSnapshots=true
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top