Anotações
Apresentação de slides
Estrutura de tópicos
1
Modulo II
Software Configuration Management - SCM
  • Professor
  • Ismael H F Santos – ismael@tecgraf.puc-rio.br
2
Bibliografia
  • Introduction to Apache Maven 2
    •  Tutorial ibm developerWorks:
  • Introduction to Maven 2
    •  http://www.javaworld.com/javaworld/jw-12-2005/jw-12-2005-maven.html

3
Ementa
  • SCM – Introducao
  • Subversion
  • Maven SCM plugin




4
MTSW-Java
5
Version Control System operations
  • Initialize
  • Add Files
  • Commit
  • View History
  • Share
  • Update
  • Revert
  • Branch


6
Remote Users
7
Subversion Architecture
  • SVN Clients & Server
  • SVN Repository


8
The Problem of File-Sharing
  • Problem to avoid !!!
9
The Lock-Modify-Unlock Solution
  • Used by Many version control systems
  • The repository allows only one person to change a file at a time.
  • This exclusivity policy is managed using locks.
  • Very restritive solution, lock related problems


10
The Copy-Modify-Merge Solution
  • Subversion, CVS, and other version control systems use it
  • Users can work in parallel, never waiting for one another.
  • When people work on the same files, it turns out that most of their concurrent changes don't overlap at all;
11
The Copy-Modify-Merge Solution
  • conflicts are infrequent.
  • the amount of time it takes to resolve conflicts is far less than the time lost by a locking system.


12
MTSW-Java
13
Subversion Basics
  • Open Source
    • http://subversion.tigris.org/
  • Designed for remote users
  • Unreserved checkouts
    • Similar to CVS
    • Checkout, edit, merge, commit
14
Subversion Basics
  • Many clients possible
    • Command-line client (included)
    • Windows GUI client (in process)
    • Other clients (more GUIs, integration with IDEs, etc)
  • Apache-based network server
    • WebDAV-based network protocol
    • High performance, scalable, secure, and more
15
Why Open Source?
  • If it is great, then it could replace CVS
    • Widespread usage would establish it as a legitimate tool
  • More and better clients are possible
  • Peer review and testing
  • Community feedback and contributions
16
Basic Method of Operation
  • Similar to CVS
  • Unreserved instead of reserved
  • Client-side working copies
  • Four basic steps
    • Check out a “working copy”
    • Make any edits
    • Merge changes from server
    • Commit your changes
17
Clients
  • Command-line client comes standard
  • Windows client: TortoiseSVN
  • Linux: GTK (X Windows) client
  • Integration with IDEs: SubEclipse plugin
  • WebDAV clients, too!
    • Microsoft Windows, Office, and others
    • Open source clients such as cadaver, Nautilus, and Goliat
18
Apache as a Server
  • WebDAV (DeltaV) for the network protocol
  • Apache 2.0 and mod_dav
  • mod_dav_svn as glue to Subversion


  • High performance, scalability, and robust
  • SSL provides encryption and authentication
  • Proxy/firewall friendly
19
Subversion vs CVS
  • Most CVS features
  • Directory versioning
  • Metadata
  • Atomic commits
  • Branching and tagging are cheap
  • Designed for the network
  • Better binary file handling
  • Layered library design
20
Revision Numbering
  • Global revision number rather than per-file
  • Allows you to talk about “revision 2524”
  • Unique identifier for a state of your project
    • Simple way to tag (next slide)
  • Each revision corresponds to a single commit
    • Contains author, log message, and date
21
Tagging and Branching
  • Subversion implements “cheap copies”
  • Branches are just copies of the main trunk
    • Make changes in the copy
    • Merge the changes back to the main trunk
  • Tags are copies which are never changed
    • Might not even be necessary if you simply record the global revision number that built your product
22
Example Repository Layout
23
Authentication
  • CVS uses a custom authentication mechanism
    • Part of CVS’s custom (non-standard) protocol
    • “I LOVE YOU” or “I HATE YOU”
    • pserver sends passwords in the clear
  • Alternate authentication schemes
    • kserver, gserver
    • SSH tunneling
  • Subversion uses HTTP as its protocol
    • Integrates with existing authentication systems
    • Standardized!
24
Modules
  • CVS modules
    • Live in CVSROOT
      • The “modules” file
      • Only the administrator can alter module definitions
    • Only apply to checkout
      • Changes are not detected during “cvs update”
  • Subversion modules
    • Directory property (“svn:externals”)
      • Users can define them, edit them, inspect them
      • Attach to any directory
    • Versioned, as with any property
      • Changes are detected during “svn update”
25
Keywords
  • CVS keywords are automatically expanded
    • User must explicitly disable this behavior
    • Risk of destroying a binary file
  • Subversion keywords are optionally expanded
    • User must proactively enable keyword expansion
    • The user states the set of keywords to expand (some or all)
    • The behavior is controlled by a property: svn:keywords
26
Directory Versioning
  • Directories are versioned items
  • Deletes and moves are recorded
  • Copy sources are remembered
27
Metadata
  • Any file or directory can store properties
  • Properties are name/value pairs
  • Some standard properties exist
    • svn:ignore
    • svn:mime-type
    • svn:eol-style
    • etc.
  • User-defined properties are allowed
  • Property values can be text or binary
28
Improved Features (1 of 2)
  • Atomic commits
    • CVS can commit one file, fail on the second
    • Subversion commits all changes, or nothing
  • Binary file handling
    • Subversion uses MIME types
    • Binary diffs
  • Newline and keyword handling is improved
    • Subversion does not munge your files until you tell it to
29
Improved Features (2 of 2)
  • Designed for the network
    • CVS had network support “bolted on”
      • Two code paths to maintain
      • Authentication poorly integrated
    • Subversion has network support (based on WebDAV/DeltaV) that was planned from the very early stages
    • Binary diffs in both directions
30
Layered Library Design
  • Many levels for interaction
    • High-level client
    • Repository access (local, remote, pipe, etc)
    • Direct access to the storage
  • Enables scripting
  • Clients can share a lot of code
    • The command-line client is a small application built on top of the high-level client library
    • GUI clients can also use the high-level library
  • Library-based enables third-parties
31
Details: repositories
  • Subversion uses URLs for repository locations
    • http://svn.collab.net/repos/svn/ is the actual URL for Subversion itself
  • Web browsers can view the “head”
    • Full ViewCVS-like functionality coming soon
  • “file” URLs are also allowed for local access
    • Example: file:///home/gstein/repos/testing/
32
Details: checkout
  • Creates a local working copy
33
Details: commit
  • Commit changes to the repository
34
Details: add
  • Add new files and directories
35
Details: mkdir
  • Simplify directory creation
36
Details: mkdir <URL>
  • Quickly sets up a new repository directory
37
Details: delete
  • Delete files and directories
38
Details: delete <URL>
  • Delete items directly from the repository
    • Great for removing obsolete tags or branches
39
Details: update
  • Retrieve changes made by other users
40
Details: status
  • Shows changes to the working copy
41
Details: copy
  • Copy files and directories
    • Source and destination can be working copies and/or direct repository references
42
Details: move
  • Move files and directories
    • The source and destination must both be working copy references, or they must both be URLs
43
Details: diff
  • Shows changes to the working copy
44
Details: log
  • Shows changes that have been committed
45
Details: revert
  • Reverts changes made to a working copy
    • Replaces CVS’s idiom of “rm file; cvs update file”
46
Details: info
  • Provide information about files / directories
47
Details: properties
  • Five different commands for manipulating properties on files and directories
48
Details: merge
  • Merges changes from two sources/revisions into a target
49
Three-way Merge
50
Details: resolve
  • Cleans up conflict files left from a conflict during “svn update” or “svn merge”
51
Details: import
  • Loads new content into a repository
52
Details: export
  • Just like a checkout, but the .svn administrative subdirectories are omitted
53
Details: switch
  • Switch a working copy to a branch
54
Additional Tools
  • cvs2svn
  • ViewSVN
  • Hook scripts
    • Send commit emails
    • Simple ACL support
    • Simple reserved checkouts
    • Repository backup

  • Libraries, scripting, svnlook
55
MTSW-Java
56
Maven in Development
57
Maven Features/Functions
  • Manage External Dependencies
  • Retrieve Source from SCM
  • Build Artifacts
  • Run Tests
  • Package Artifacts (jar,war,zip,tar…)
  • Generate Project Reports
  • Create Website of Project Info
  • Deploy Website and Distributions
  • Extensible via Plugins
58
Maven Overview
59
Coding Standards & Maven
  • Maven Provides a Plug-In Architecture for 3rd Party Applications
  • Check Style Description
    • Development Tool for Java Programmers
    • Flexible Enough to Support Any Standard
    • Checks Coding Style and Coding Structure
    • Optional Checks Include J2EE Requirements

60
Coding Standards & Maven
61
SCM Plugin has 16 goals
  • Seamlessly integrates Maven processes with your SCM repository.
    • mvn scm:diff
      • Creates UNIX diff file
    • mvn scm:tag
    • mvn scm:status


  • Dozens of SCM systems supported.
    • CVS, Subversion, Git

62
Maven SCM Support
  • Seamlessly integrates Maven processes with your SCM repository.
    • scm:branch - branch the project
    • scm:validate - validate the scm information in the pom
    • scm:add - command to add file
    • scm:unedit - command to stop editing the working copy
    • scm:export - command to get a fresh exported copy
    • scm:bootstrap - command to checkout and build a project
    • scm:changelog - command to show the source code revisions
    • scm:list - command for get the list of project files
63
SCM Plugin
  • The scm plugin maps a lot of commands to a variety of scm implementations
    • 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).
64
SCM Plugin
  • Configuration
  • ...
  • <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>
  • ...
  • </project>
  • http://maven.apache.org/scm/maven-scm-plugin/usage.html
65
SCM Plugin
  • Configuration
  • ...
  • <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>
  • ...
  • </project>
  • http://maven.apache.org/scm/maven-scm-plugin/usage.html
66
SCM Plugin
  • Bootstrapping a Project Using a POM
    • http://maven.apache.org/scm/maven-scm-plugin/examples/bootstrapping-with-pom.html


  • Other SCM Commands
    •  http://maven.apache.org/scm/maven-scm-plugin/examples/scm-advance-features.html