------ Introduction ------ Dan Tran ------ 20014-06-10 ------ ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Introduction {{{https://swarm.workshop.perforce.com/files/guest/perforce_software/p4maven/main}P4Maven}} original was developed and open sourced by Perforce in 2011 using Perforce's proprietary P4Java, a Java client api. It was a port of {{{http://maven.apache.org/scm/perforce.html}Maven SCM Perforce Provider using p4 commandline}}. In 6/2014, P4Maven was refactor by Dan Tran to provide the following improvements * Auto discover the existing Perforce client that manages checked out Maven source tree. User is no longer required to configure the client name via Java system properties * Generate clients are auto destroyed after each JVM session. * Full integration with Maven SCM and Release plugin * Comply with Maven Scm's Technology Compatibility Kit (TCK) * Added Lots of Maven Plugin Integration Tests via Maven Invoker [] * SCM URL The general format for a Perforce P4Maven SCM URL is ------- scm:p4:[protocol:][[username[:password]@]hostname:port:]//depot/path/to/project ------- Examples ------- scm:p4://depot/path/to/project scm:p4:host://depot/path/to/project scm:p4:ssl:host:3666://depot/path/to/project scm:p4:ssl:user:password@host:3666://depot/path/to/project ------- Notes: * 'tcp' is implicitly used when protocol field is not given. See Perforce documentation to see a list of supported protocols. However, as of this writting P4Maven provider supports only 'tcp' and 'ssl' protocols * 1666 is the default port when not given * When host properties are not provided, P4PORT environment variable will be used * When P4PORT system property, it overrides host info provided under the URL [] * Provider Configuration This provider also has a list of global settings which can be configured using its glocal configuration file at $\{user.home}/.scm/p4maven-settings.xml. The format of this settings is ------------------------------- <p4maven-settings> <key>value</key> </p4maven-settings> ------------------------------- These setttings are overridable from command line using Java system properties (ie -Dkey=value ) *-----------------+-------------------+----------------------+---------+---------+------------------------------------------+ | System Property | ENV Key | p4maven-settings Key | Type | Default | Description | *-----------------+-------------------+----------------------+---------+---------+------------------------------------------+ | P4PORT | P4PORT | p4port |String | | P4PORT info | *-----------------+-------------------+----------------------+---------+---------+------------------------------------------+ | P4JOBS | N/A | jobs |String | | List of Perfoce Job ID separated by space for any submit action like checkin *-----------------+-------------------+----------------------+---------+---------+------------------------------------------+ | P4CLIENT | N/A | N/A |String | | A client name to be used as part of inital checkout action. | | | | | | Unpredictable result when it is set and use multitple checkouts under same JVM | | | | | | For other action, the client is discover or generated *-----------------+-------------------+----------------------+---------+---------+------------------------------------------+ | P4CHARSET | P4CHARSET | charset |String | | Server connection charset *-----------------+-------------------+----------------------+---------+---------+------------------------------------------+ | P4LOCKTAG | N/A | lockTag |boolean | true | Lock the created label at tag action *-----------------+-------------------+----------------------+---------+---------+------------------------------------------+ * Working with Maven SCM and Release Plugins [[]] Check out the source tree with a known client [[]] Add this provider to plugin dependency ----------------------------------------- <build> <defaultGoal>install</defaultGoal> <pluginManagement> <plugins> [...] <!-- add this if release plugin will be used to release your project --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> [...] <dependencies> <dependency> <groupId>com.perforce.p4maven</groupId> <artifactId>p4maven-provider</artifactId> <version>${p4maven.version}</version> </dependency> </dependencies> [...] </plugin> <!-- add this if scm plugin will be used with your porject --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-scm-plugin</artifactId> [...] <dependencies> <dependency> <groupId>com.perforce.p4maven</groupId> <artifactId>p4maven-provider</artifactId> <version>${p4maven.version}</version> </dependencythis> </dependencies> [...] </plugin> [...] </plugins> </pluginManagement> [...] </build> ----------------------------------------------------------------------- [[]] Configure SCM element in your project top level pom * The following example show how to configure \<scm\> element with host configurations. --------------------------------- <scm> <connection>scm:p4:workshop.perforce.com:1666://guest/dantran/p4maven</connection> <developerConnection>scm:p4:workshop.perforce.com:1666://guest/dantran/p4maven</developerConnection> <url>https://swarm.workshop.perforce.com/files/guest/dantran/p4maven</url> </scm> -------------------------------- [] * The following example show how to configure \<scm\> element without host configurations which must be set either from environment variable or Java system property "P4PORT". This configuration is suitable for multi sites, with each site has its own P4PORT mirror to a central Perforce server. --------------------------------- <scm> <connection>scm:p4://guest/dantran/p4maven</connection> <developerConnection>scm:p4://guest/dantran/p4maven</developerConnection> <url>https://swarm.workshop.perforce.com/files/guest/dantran/p4maven</url> </scm> -------------------------------- * The credential can be configured using plugin's specific properties or {{{http://maven.apache.org/scm/maven-scm-plugin/examples/bootstrapping-with-pom.html}local's settings.xml}}
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#12 | 11406 | dantran | Remote Maven site, place important user and dev doc at root level instead | ||
#11 | 10095 | dantran |
more cannonical path handling during client discovery. Update user doc on how to use hide SCM credential using local's settings.xml |
||
#10 | 9705 | dantran |
- add apache snapshot repo for maven-scm-test-1.10-SNAPSHOT - add settings'checkStaledConnection for optimization purpose |
||
#9 | 9681 | dantran | add site report | ||
#8 | 9632 | dantran |
- use groupId:artifactId:version to test release automation - Implment p4maven-settings.xml's p4Port field |
||
#7 | 9621 | dantran | add strictClientDiscovery external setting | ||
#6 | 9597 | dantran |
- minor cleanup - doc update |
||
#5 | 9580 | dantran | explain URL examples | ||
#4 | 9561 | dantran |
- it/release now can be used to test after release:perform - only deploy site during release:perform - more dev and user doc |
||
#3 | 9548 | dantran |
- pickup P4PORT form env and system properties to support multi site using proxy - add development doc - check for error after each action |
||
#2 | 9524 | dantran | switch default tck's depot from //depot to //scmtck to be very specific since user may have a //depot in production | ||
#1 | 9519 | dantran | folder rename to match with its artifactId | ||
//guest/dantran/p4maven/com.perforce.maven/src/site/apt/index.apt | |||||
#2 | 9513 | dantran | add provider doc, deploy site:jar, support external charset config | ||
#1 | 9498 | dantran |
- Setup Maven site for documetation - Implement ~/m2/p4maven-settings.xml to store external config overridable by system properties. All global settings now can be retrieved va P4Utils |