The scm plugin maps a lot of commands to a variety of scm implementations. But there are only 2 frequently used commands:
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 scm configuration in your pom.xml.
[...] <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.cvs</url> </scm> [...]
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 maven scm list for the list of supported SCMs.
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
There two possible scm connections that can be used in the pom.xml, connection and developerConnection.
[...] <build> [...] <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-scm-plugin</artifactId> <version>1.0-SNAPSHOT</version> <configuration> <connectionType>connection</connectionType> </configuration> </plugin> [...] </plugins [...] </build> [...]
[...] <build> [...] <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-scm-plugin</artifactId> <version>1.0-SNAPSHOT</version> <configuration> <connectionType>developerConnection</connectionType> </configuration> </plugin> [...] </plugins [...] </build> [...]