I am migrating a project to Maven and as we were used to always reference our builds by the latest change number in our Perforce SCM repository, I would like to be able to extract this information
I am trying to configure Maven scm plugin via following resources:
- http://maven.apache.org/scm/maven-scm-plugin/usage.html for generic usage
- http://www.perforce.com/perforce/doc.current/manuals/p4maven/index.html
First I don't understand how to make it work, so if anybody has a fully working example, I will be happy to, on my side I have tried by adding in my pom:
<scm>
<connection>
scm:perforce:localhost:1666://depot/
<my_project>
/
<version>
</connection>
<developerConnection>
scm:perforce:localhost:1666:/depot/
<my_project>
/
<version>
</developerConnection>
<url>http://somerepository.com/view.cvs</url>
</scm>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.6</version>
<dependencies>
<!-- P4Maven -->
<dependency>
<groupId>com.perforce</groupId>
<artifactId>p4maven</artifactId>
<version>[2011,2012)</version>
</dependency>
</dependencies>
<configuration>
<connectionType>//depot/proto/kernel/kernel/04.00/maven2</connectionType>
<username>my local username</username>
<password>xxxxxx</password>
<includes>**</includes>
</configuration>
</plugin>
</plugins>
this is leading me to:
[INFO] --- maven-scm-plugin:1.6:checkout (default-cli) @ kernel ---
mars 27, 2012 9:54:08 AM org.sonatype.guice.bean.reflect.Logs$JULSink warn
Avertissement: Error injecting: org.apache.maven.scm.provider.svn.svnexe.SvnExeScmProvider
java.lang.NoClassDefFoundError: org/apache/maven/scm/command/info/InfoScmResult
Surely forgot something, I will try to read again the instructions and see what I miss, but if anybody knows ...
Anyway, my question is rather: is it worth trying it ? I don't see in the available actions from scm plugin anything that will help me getting the last change information and integrate it into a reference build number. Shall I develop my own plugin for this ?
Thanks in advance.
I got some advice from one of the P4Maven developers that might help.
First, check your configuration. The "..." in the "" tag should be one of the tag names in the "" tag (i.e. "connection" or "developerConnection")
There two options to use Maven with Perforce SCM.
Use the default (built-in) Maven Perforce SCM provider (p4 commandline based)
[environment variables] P4CLIENT= P4USER= P4PASSWD=
or
[JVM args] -Dusername= -Dpassword=
[pom.xml] ...
...
...
[pom.xml]
...
...
scm4:localhost:1666://depot/someproject scm4:localhost:1666://depot/someproject scm4://depot/someproject
...
Note that for P4Maven we're overriding the default provider inside the "maven-scm-plugin" plugin.
Note that we're using "scmp4" (if using P4Maven) instead of "scmperforce" (built-in default) as the provider name, since "perforce" is taken by the existing default implementation.