| 1 |
------ |
| 2 |
Usage |
| 3 |
------ |
| 4 |
Pete Marvin King |
| 5 |
------ |
| 6 |
2008-08-13 |
| 7 |
------ |
| 8 |
|
| 9 |
~~ Licensed to the Apache Software Foundation (ASF) under one |
| 10 |
~~ or more contributor license agreements. See the NOTICE file |
| 11 |
~~ distributed with this work for additional information |
| 12 |
~~ regarding copyright ownership. The ASF licenses this file |
| 13 |
~~ to you under the Apache License, Version 2.0 (the |
| 14 |
~~ "License"); you may not use this file except in compliance |
| 15 |
~~ with the License. You may obtain a copy of the License at |
| 16 |
~~ |
| 17 |
~~ http://www.apache.org/licenses/LICENSE-2.0 |
| 18 |
~~ |
| 19 |
~~ Unless required by applicable law or agreed to in writing, |
| 20 |
~~ software distributed under the License is distributed on an |
| 21 |
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 22 |
~~ KIND, either express or implied. See the License for the |
| 23 |
~~ specific language governing permissions and limitations |
| 24 |
~~ under the License. |
| 25 |
|
| 26 |
~~ NOTE: For help with the syntax of this file, see: |
| 27 |
~~ http://maven.apache.org/doxia/references/apt-format.html |
| 28 |
|
| 29 |
Usage |
| 30 |
|
| 31 |
The SCM Plugin maps a lot of commands to a variety of scm implementations. But there are only 2 frequently |
| 32 |
used commands: |
| 33 |
|
| 34 |
* checkin - commit the changes to the remote repository ( scm server ). |
| 35 |
|
| 36 |
* update - updates the local working copy with the one from the remote repository ( scm server ). |
| 37 |
|
| 38 |
[] |
| 39 |
|
| 40 |
Configuring SCM |
| 41 |
|
| 42 |
Each scm has a different command line invocation to commit the modified sources. Using maven this process is |
| 43 |
simplified by providing a uniform way to do this by letting maven handle the command line translation to perform |
| 44 |
the scm task. |
| 45 |
|
| 46 |
To configure the scm support for maven you need the {{{http://maven.apache.org/pom.html#SCM}scm}} configuration in your <<<pom.xml>>>. |
| 47 |
|
| 48 |
+---------+ |
| 49 |
<project> |
| 50 |
... |
| 51 |
<packaging>jar</packaging> |
| 52 |
<version>1.0-SNAPSHOT</version> |
| 53 |
<name>SCM Sample Project</name> |
| 54 |
<url>http://somecompany.com</url> |
| 55 |
<scm> |
| 56 |
<connection>scm:svn:http://somerepository.com/svn_repo/trunk</connection> |
| 57 |
<developerConnection>scm:svn:https://somerepository.com/svn_repo/trunk</developerConnection> |
| 58 |
<url>http://somerepository.com/view.cvs</url> |
| 59 |
</scm> |
| 60 |
... |
| 61 |
</project> |
| 62 |
+---------+ |
| 63 |
|
| 64 |
Maven will use the information embedded in the scm configuration to determine the command mapping for the scm command. |
| 65 |
The scm configuration url is composed of different information that defines the mapping: |
| 66 |
|
| 67 |
+------+ |
| 68 |
scm:svn:http://somerepository.com/svn_repo/trunk |
| 69 |
<service name>:<scm implementation>:<repository url> |
| 70 |
+------+ |
| 71 |
|
| 72 |
Check the {{{http://maven.apache.org/scm/scms-overview.html}maven scm list}} for the list of supported SCMs. |
| 73 |
|
| 74 |
Committing and updating changes through Maven |
| 75 |
|
| 76 |
Assuming that SCM has been configured in the <<<pom.xml>>> and the project directory is managed by a SCM, invoking |
| 77 |
the checkin goal in the scm will start the commit process for all configured sources in your <<<pom.xml>>>. |
| 78 |
|
| 79 |
<<The files should be added beforehand by an external scm client.>> |
| 80 |
|
| 81 |
+-----+ |
| 82 |
mvn -Dmessage="<commit_log_here>" scm:checkin |
| 83 |
+-----+ |
| 84 |
|
| 85 |
for update |
| 86 |
|
| 87 |
+-----+ |
| 88 |
mvn scm:update |
| 89 |
+-----+ |
| 90 |
|
| 91 |
Specifying the scm connection to use |
| 92 |
|
| 93 |
There two possible scm connections that can be used in the <<<pom.xml>>>, connection and developerConnection. |
| 94 |
|
| 95 |
* connection configuration |
| 96 |
|
| 97 |
+-----------+ |
| 98 |
<project> |
| 99 |
... |
| 100 |
<build> |
| 101 |
[...] |
| 102 |
<plugins> |
| 103 |
<plugin> |
| 104 |
<groupId>org.apache.maven.plugins</groupId> |
| 105 |
<artifactId>maven-scm-plugin</artifactId> |
| 106 |
<version>${project.version}</version> |
| 107 |
<configuration> |
| 108 |
<connectionType>connection</connectionType> |
| 109 |
</configuration> |
| 110 |
</plugin> |
| 111 |
... |
| 112 |
</plugins |
| 113 |
... |
| 114 |
</build> |
| 115 |
... |
| 116 |
</project> |
| 117 |
+-----------+ |
| 118 |
|
| 119 |
* developerConnection configuration |
| 120 |
|
| 121 |
+-----------+ |
| 122 |
<project> |
| 123 |
... |
| 124 |
<build> |
| 125 |
... |
| 126 |
<plugins> |
| 127 |
<plugin> |
| 128 |
<groupId>org.apache.maven.plugins</groupId> |
| 129 |
<artifactId>maven-scm-plugin</artifactId> |
| 130 |
<version>${project.version}</version> |
| 131 |
<configuration> |
| 132 |
<connectionType>developerConnection</connectionType> |
| 133 |
</configuration> |
| 134 |
</plugin> |
| 135 |
... |
| 136 |
</plugins |
| 137 |
... |
| 138 |
</build> |
| 139 |
... |
| 140 |
</project> |
| 141 |
+-----------+ |
| 142 |
|
| 143 |
Related Links |
| 144 |
|
| 145 |
* {{{../matrix.html}SCM Plugin Matrix}} |
| 146 |
|
| 147 |
[] |