| 1 |
-------------- |
| 2 |
Maven SCM Jazz Provider |
| 3 |
-------------- |
| 4 |
Chris Graham |
| 5 |
-------------- |
| 6 |
2012-03-19 |
| 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 |
The Jazz provider implements Maven's generic SCM API for the Jazz SCM system. |
| 30 |
|
| 31 |
Jazz SCM is included in the Rational Team Concert product. |
| 32 |
|
| 33 |
Deprecation Notice |
| 34 |
|
| 35 |
This SCM provider is deprecated and will be removed in version 2.0.0. |
| 36 |
|
| 37 |
Use Cases |
| 38 |
|
| 39 |
The provider must handle a number of different use cases: |
| 40 |
|
| 41 |
* Label a source tree and check out that label to a temp directory (the release plugin). |
| 42 |
|
| 43 |
* Provide a changelog between dates/revisions and checkout code to a directory (Continuum et al). |
| 44 |
|
| 45 |
* Map a number of commands designed for CVS/SVN onto the semantics provided by Jazz SCM (the scm plugin). |
| 46 |
|
| 47 |
Details |
| 48 |
|
| 49 |
The main semantic issue faced by the provider is CVS/SVN's (around which the original SCM API and |
| 50 |
release manager/plugin where written) concept of a working copy versus Jazz SCM's concept of a Sandbox, |
| 51 |
Repository Workspace and Stream. |
| 52 |
|
| 53 |
CVS/SVN allow the user to checkout any repository location to any local directory at will and tracks this |
| 54 |
by keeping metadata in a CVS/.svn directory. |
| 55 |
|
| 56 |
Jazz Basics |
| 57 |
|
| 58 |
Jazz SCM uses a "remote repository workspace", or more commonly called a "repository workspace", which |
| 59 |
is an object in the repository on the Jazz server, used to store items that have been placed under |
| 60 |
source control. A "sandbox" is a copy of the "repository workspace" on your local machine, which exists |
| 61 |
as files and directories, where you perform your changes. The .jazz5 metadata directory contains the |
| 62 |
metadata for the sandbox, which includes information about which files and folders have been loaded |
| 63 |
from the remote repository workspace. Overlapping sandboxes (a sandbox within a sandbox) are not permitted. |
| 64 |
This limitation forces us to use the <<<workingDirectory>>> option when using the <<<release:perform>>> |
| 65 |
goal. The working directory must be outside of the current sandbox. |
| 66 |
|
| 67 |
Relationships between Streams, Repository Workspaces, Components and Sandboxes. |
| 68 |
|
| 69 |
In the simplest case, we have a single Repository Workspace, with a single Component in it. Associated with |
| 70 |
that, we have a sandbox. |
| 71 |
|
| 72 |
[images/WorkspaceOnly.png] Relationships between Repository Workspaces, Components and Sandboxes. |
| 73 |
|
| 74 |
Adding a Stream introduces the concept of Flow Targets. |
| 75 |
|
| 76 |
[images/WorkspaceWithStream.png] Relationships between Streams, Repository Workspaces, Components and Sandboxes. |
| 77 |
|
| 78 |
A Repository Workspace may be configured to have a Flow Target. A flow target may be a Stream or another |
| 79 |
Repository Workspace. A Repository Workspace can have multiple flow targets simultaneously. Flow targets |
| 80 |
can also be changed. |
| 81 |
|
| 82 |
A developer will <<<deliver>>> their changes to the flow targets defined for their Repository Workspace. |
| 83 |
The corresponding action for a Snapshot is the <<<promote>>> operation. Another developer will <<<accept>>> |
| 84 |
those changes when they are ready too. |
| 85 |
|
| 86 |
Flow Targets |
| 87 |
|
| 88 |
V1.4 of the Maven SCM API introduced an option {{{http://maven.apache.org/scm/maven-scm-plugin/checkin-mojo.html#pushChanges}pushChanges}} |
| 89 |
that allows for changes in distributed SCM to be pushed into a central repository. |
| 90 |
|
| 91 |
In Jazz terms, a <<<checkin>>> or <<<load>>> operates between the <<<sandbox>>> and the <<<repository workspace>>>. |
| 92 |
|
| 93 |
A <<<deliver>>> or <<<accept>>> operates between a <<<repository workspace>>> and its flow target, |
| 94 |
normally a <<<stream>>> but could also be another <<<repository workspace>>>. The <<<promote>>> is used to |
| 95 |
|
| 96 |
The Maven <<<pushChanges>>> option controls the <<<deliver>>> or <<<promote>>> operations. |
| 97 |
|
| 98 |
The <<<pushChanges>>> option, by default is <<<true>>>, but for the <<<deliver>>> or <<<promote>>> operations |
| 99 |
to have meaning, the <<<repository workspace>>> needs to have a flow target defined. |
| 100 |
|
| 101 |
If the <<<pushChanges>>> option is <<<true>>> (the default), and there is no flow target defined, then no |
| 102 |
<<<deliver>>> or <<<promote>>> operations are attempted. |
| 103 |
|
| 104 |
Limitations |
| 105 |
|
| 106 |
One other thing to be aware of, is that Jazz allows you to have the same name for Repository Workspaces, |
| 107 |
Streams, Components and Baselines. This provider will create a Repository Workspace of the same name as |
| 108 |
the Snapshot, as currently the underlying tool, <<<scm>>>, does not allow the direct loading of a snapshot |
| 109 |
into a sandbox. It is recommended that the user implements some namespace standards and policies to help |
| 110 |
manage this. |
| 111 |
|
| 112 |
URL Format |
| 113 |
|
| 114 |
<<<scm:jazz:[username[;password]@]http[s]://server_name[:port]/contextRoot:repositoryWorkspace>>> |
| 115 |
|
| 116 |
* <username;password> May be provided directly in the pom, or using the server_name:port to obtain |
| 117 |
the details from the user's settings.xml file. |
| 118 |
|
| 119 |
* http[s]://server_name:port/contextRoot Specify the jazz server and path to connect to. The context root |
| 120 |
is usually 'jazz' or 'ccm'. |
| 121 |
|
| 122 |
* <repositoryWorkspace> The name of the user's remote repository workspace used to checkin to, or load from. |
| 123 |
|
| 124 |
Working with the Release Plugin |
| 125 |
|
| 126 |
We are able to use the <<<release:prepare>>> and <<<release:perform>>> goals in the one invocation, |
| 127 |
however, due to the sandbox within a sandbox issues discussed above, we need to use the <<<workingDirectory>>> |
| 128 |
option. |
| 129 |
|
| 130 |
Here is a sample: |
| 131 |
|
| 132 |
+-- |
| 133 |
mvn -B -Dresume=false -DworkingDirectory=/tmp/maven release:prepare release:perform |
| 134 |
+-- |
| 135 |
|
| 136 |
For a complete explanation on the restrictions and limitations of using this provider, see |
| 137 |
the link, "Working with the Release Plugin" above. |
| 138 |
|
| 139 |
SCM Commands |
| 140 |
|
| 141 |
* Login |
| 142 |
|
| 143 |
Although the <<<scm>>> command supports persistent login using the <<<scm login>>> command, it is not |
| 144 |
used by this provider. The username and password can either come from the URL in the pom.xml file, or |
| 145 |
from a <<< <server> >>> section in a settings.xml file. The password is masked in the output of the |
| 146 |
execution of the scm command. |
| 147 |
|
| 148 |
<<Note>> Having the username and password set in the pom.xml takes precedence over the <<< <server> >>> |
| 149 |
entry from settings.xml. |
| 150 |
|
| 151 |
* Add |
| 152 |
|
| 153 |
Jazz SCM does not have the equivalent of an add command. This implementation uses the <<<scm checkin>>> |
| 154 |
command. However, it does not call the <<<scm deliver>>> command, nor does it create a <<<changeset>>>. |
| 155 |
|
| 156 |
* Blame |
| 157 |
|
| 158 |
This provider uses the <<<scm annotate>>> command. |
| 159 |
|
| 160 |
* Branch |
| 161 |
|
| 162 |
Not implemented. |
| 163 |
|
| 164 |
A branch in Jazz SCM is roughly equivalent to a Stream or possibly even a Repository Workspace, depending |
| 165 |
on how the flow targets have been defined, thus the branch command could be used to create a new Stream |
| 166 |
or Repository Workspace. The Jazz SCM command <<<scm create workspace>>> can be used to create new Repository |
| 167 |
Workspaces, however, there is currently no <<<scm create stream>>> command. |
| 168 |
|
| 169 |
Jazz SCM also further complicates the issue by allowing multiple flow targets. |
| 170 |
|
| 171 |
This provider does not currently explicitly support multiple flow targets. When there are multiple flow |
| 172 |
targets defined, the flow target defined as "current" will be used, not the "default" one. This information |
| 173 |
is obtained from the output of the <<<scm status>>> command. |
| 174 |
|
| 175 |
<<<Note>>> Some commands, such as <<<edit>>> and <<<unedit>>> work with the implicit flow targets of the |
| 176 |
Repository Workspace. |
| 177 |
|
| 178 |
* Changelog |
| 179 |
|
| 180 |
This provider uses the <<<scm history>>> command to obtain a list of all changesets. It then uses the |
| 181 |
<<<scm list changesets>>> to obtain the details of each individual changeset. |
| 182 |
|
| 183 |
* Checkin |
| 184 |
|
| 185 |
This provider will create a changeset with the provided message. |
| 186 |
The implementation uses the <<<scm checkin>>> command, it uses the Add command implementation. |
| 187 |
|
| 188 |
If the repository workspace has a valid flow target (ie, not itself) and the <<<pushChanges>>> option |
| 189 |
it <<<true>>>, which by default it is, then this provider will also deliver the changes to the |
| 190 |
flow target using the <<<scm deliver>>> command. |
| 191 |
|
| 192 |
Note: Only a single flow target is currently supported. When multiple flow targets have been defined, |
| 193 |
the flow target marked as "current" will be used. This provider is not aware of the other targets. This |
| 194 |
information is not available from the <<<scm status>>> command. |
| 195 |
|
| 196 |
* Checkout |
| 197 |
|
| 198 |
The implementation uses the <<<scm load>>> command. |
| 199 |
|
| 200 |
* Diff |
| 201 |
|
| 202 |
The diff implementation produces a diff based on the difference between changes in the sandbox and |
| 203 |
the repository workspace. A flow target, if defined, is not used. The <<<scm>>> command is not |
| 204 |
currently able to produce a single diff output of all files that have changed. So the <<<scm status>>> |
| 205 |
command is used to determine all changed files, and then iterates through the list, calling <<<scm diff>>> |
| 206 |
for each individual file. |
| 207 |
|
| 208 |
By default, an $\{artifactId\}.diff file will be produced in the current working directory. This .diff file |
| 209 |
can be then imported into the Eclipse Client using the following procedure. |
| 210 |
|
| 211 |
Right click, then, Team > Apply Patch... |
| 212 |
|
| 213 |
In the dialog that opened, select the patch file. Note that no files will be shown in the |
| 214 |
'This patch effects the following files' list. Select Next. Choose the 'Workspace Root' |
| 215 |
radio button and then click on the Finish button. |
| 216 |
|
| 217 |
In the 'Pending Changes' view, select 'Merge into Workspace'. The patch will be applied. |
| 218 |
|
| 219 |
* Edit |
| 220 |
|
| 221 |
The implementation uses the <<<scm lock acquire>>> command, and uses the implicit flow targets defined |
| 222 |
for the repository workspace. If none are defined, the command will fail. |
| 223 |
|
| 224 |
* List |
| 225 |
|
| 226 |
The <<<scm status>>> command is called first to obtain the remote repository workspace and |
| 227 |
component name. These are then used as parameters for the <<<scm list remotefiles>>> command. |
| 228 |
|
| 229 |
* Status |
| 230 |
|
| 231 |
This provider uses the <<<scm status>>> command. |
| 232 |
|
| 233 |
* Tag |
| 234 |
|
| 235 |
The <<<scm status>>> command is called first to obtain the remote repository workspace and |
| 236 |
stream name. The Jazz SCM equivalent of a tag is a snapshot. A baseline could have been used, |
| 237 |
however, baselines are not supported or used by this provider. Please note however, that when |
| 238 |
a snapshot is created, a baseline will also be implicitly created. Also, Jazz SCM currently |
| 239 |
does not support the loading of a snapshot directly, we can only load from a repository workspace. |
| 240 |
So, to facilitate this, the tag command also creates a remote workspace repository of the same name |
| 241 |
as the tag, ie: <<<$\{artifactId\}-$\{version\}>>>. |
| 242 |
|
| 243 |
This provider can call up to four different <<<scm>>> commands to fully accomplish this function. |
| 244 |
|
| 245 |
* The <<<scm create snapshot>>> command is first called to create snapshot. |
| 246 |
|
| 247 |
* The <<<scm create workspace>>> command is called to create a repository workspace that can later be loaded by the checkout command (for the release plugin). |
| 248 |
|
| 249 |
* The <<<scm deliver>>> command is called to deliver the changes to the flow target (if defined and pushChanges is true). |
| 250 |
|
| 251 |
* The <<<scm snapshot promote>>> command is called to promote the snapshot to the flow target (if defined and pushChanges is true). |
| 252 |
|
| 253 |
* Unedit |
| 254 |
|
| 255 |
The implementation uses the <<<scm lock release>>> command, and uses the implicit flow targets defined |
| 256 |
for the repository workspace. If none are defined, the command will fail. |
| 257 |
|
| 258 |
* Update |
| 259 |
|
| 260 |
This provider uses the <<<scm accept>>> command to receive updates into the remote repository workspace. |
| 261 |
If a sandbox has been loaded from the remote repository workspace, it too will also be updated. |
| 262 |
|
| 263 |
Troubleshooting |
| 264 |
|
| 265 |
Generally to get yourself out of trouble you'll need to manipulate Jazz externally by either using the <<<scm>>> command |
| 266 |
or using the RTC Eclipse client to resolve the issues encountered. |
| 267 |
|
| 268 |
Issues |
| 269 |
|
| 270 |
The <<<scm>>> command still has a number of issues dealing with files in the sandbox root directory. There are a number of |
| 271 |
Work Items on jazz.net that have been opened to track this, and other issues raised by the implementation of this provider. |
| 272 |
|
| 273 |
However, despite this, this implemention provides sufficient functionality to be able to successfully work with the maven release plugin. |