 ------
 Usage
 ------
 Pete Marvin King
 ------
 2008-08-13
 ------

~~ Licensed to the Apache Software Foundation (ASF) under one
~~ or more contributor license agreements.  See the NOTICE file
~~ distributed with this work for additional information
~~ regarding copyright ownership.  The ASF licenses this file
~~ to you under the Apache License, Version 2.0 (the
~~ "License"); you may not use this file except in compliance
~~ with the License.  You may obtain a copy of the License at
~~
~~   http://www.apache.org/licenses/LICENSE-2.0
~~
~~ Unless required by applicable law or agreed to in writing,
~~ software distributed under the License is distributed on an
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~~ KIND, either express or implied.  See the License for the
~~ specific language governing permissions and limitations
~~ under the License.

~~ NOTE: For help with the syntax of this file, see:
~~ http://maven.apache.org/doxia/references/apt-format.html

Usage

 The SCM Plugin maps a lot of commands to a variety of scm implementations. But there are only 2 frequently
 used commands:

  * checkin - commit the changes to the remote repository ( scm server ).

  * update - updates the local working copy with the one from the remote repository ( scm server ).

  []

Configuring SCM

 Each scm has a different command line invocation to commit the modified sources. Using maven this process is
 simplified by providing a uniform way to do this by letting maven handle the command line translation to perform
 the scm task.

 To configure the scm support for maven you need the {{{http://maven.apache.org/pom.html#SCM}scm}} configuration in your <<<pom.xml>>>.

+---------+
<project>
  ...
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>SCM Sample Project</name>
  <url>http://somecompany.com</url>
  <scm>
    <connection>scm:svn:http://somerepository.com/svn_repo/trunk</connection>
    <developerConnection>scm:svn:https://somerepository.com/svn_repo/trunk</developerConnection>
    <url>http://somerepository.com/view.cgi</url>
  </scm>
  ...
</project>
+---------+

 Maven will use the information embedded in the scm configuration to determine the command mapping for the scm command.
 The scm configuration url is composed of different information that defines the mapping:

+------+
   scm:svn:http://somerepository.com/svn_repo/trunk
   <service name>:<scm implementation>:<repository url>
+------+

  Check the {{{http://maven.apache.org/scm/scms-overview.html}maven scm list}} for the list of supported SCMs.

Committing and updating changes through Maven

 Assuming that SCM has been configured in the <<<pom.xml>>> and the project directory is managed by a SCM, invoking
 the checkin goal in the scm will start the commit process for all configured sources in your <<<pom.xml>>>.

 <<The files should be added beforehand by an external scm client.>>

+-----+
  mvn -Dmessage="<commit_log_here>" scm:checkin
+-----+

 for update

+-----+
  mvn scm:update
+-----+

Specifying the scm connection to use

 There two possible scm connections that can be used in the <<<pom.xml>>>, connection and developerConnection.

 * connection configuration

+-----------+
<project>
  ...
  <build>
    [...]
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-scm-plugin</artifactId>
        <version>${project.version}</version>
        <configuration>
          <connectionType>connection</connectionType>
        </configuration>
      </plugin>
      ...
    </plugins
    ...
  </build>
  ...
</project>
+-----------+

 * developerConnection configuration

+-----------+
<project>
  ...
  <build>
    ...
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-scm-plugin</artifactId>
        <version>${project.version}</version>
        <configuration>
          <connectionType>developerConnection</connectionType>
        </configuration>
      </plugin>
      ...
    </plugins
    ...
  </build>
  ...
</project>
+-----------+

Related Links

  * {{{../matrix.html}SCM Plugin Matrix}}

  []
