17.08.2016 Views

Apache Maven 3 Cookbook

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 3<br />

Subversion commands Mercurial commands Git commands<br />

svn checkout<br />

svn add<br />

svn delete<br />

svn commit<br />

svn update<br />

svn diff<br />

svn log<br />

svn merge<br />

and so on.<br />

Hg init<br />

hg clone<br />

hg add<br />

hg commit<br />

hg status<br />

hg pull<br />

hg push<br />

hg serve<br />

and so on.<br />

git init<br />

git clone<br />

git add<br />

git commit<br />

git status<br />

git diff<br />

git reset<br />

git merge<br />

and so on.<br />

The source code configuration (SCM) information can be added to the POM file of an <strong>Apache</strong><br />

<strong>Maven</strong> project.<br />

<br />

...<br />

...<br />

...<br />

...<br />

<br />

...<br />

The preceding code snippet shows details of a revision control repository added in a project<br />

POM file. The connection and developerConnection elements represent the read-only<br />

and read/write paths of the repository respectively. The tag element dictates which tag is<br />

being worked upon, while the url field is an optional field for a publicly browseable view of<br />

the source code.<br />

How it works...<br />

The workflow for the three revision control systems–SVN, Mercurial, and Git–can be different<br />

depending on the configuration. However, a likely configuration for smaller teams (2-12<br />

people) would involve a centralized repository even while you are leveraging benefits of<br />

Distributed version control systems such as Git or Mercurial.<br />

In such a case, the first step for a new developer would be to extract the source code on his<br />

/ her workstation. With SVN, this would be the svn Checkout command, while for Git or<br />

Mercurial you would use the clone command. In SVN, it is likely that you would be getting<br />

only a copy of the HEAD revision while the clone command for Git / Mercurial extracts the<br />

entire repository.<br />

59

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!