Usage of SVN Externals

March 7, 2011 nick gulrajani

How do people typically create dependencies using Subversion?

Here are some guidelines:

  • Avoid copying common code; for example, you don’t want JBoss in every java project
  • Be able to easily reference a “pegged” revision of the code.  For example, your project may specifically require version 3_2_6 of JBoss
  • Be able to track the “bleeding edge” of some dependencies, for example, you may want to always stay current on the spring framework you use

A common strategy for dealing with this situation in Subversion is something called the “externals”.  The externals in Subversion could be  a link to another subversion repository.

Since all Subversion repositories are identified by URL, it is easy to construct a reference to an external source.

Externals make use of another feature of Subversion, the property.

Properties are simply name/value pairs.  An example might make this clearer.

Suppose your development project has the following structure:





And our development project component uses JBoss.  We are required to use the latest version of gddwebapps but gddwebapps has specific dependencies on JBoss 3_2_6

And further suppose our development group has setup a repository containing versions of gddwebapps component at this URL:

And the JBoss 3_2_6 is located in another SVN repository

Using the setup below, one would set the built-in subversion property, svn:externals on the /trunk/thirdparty directory.

This property would have this value:


So how would you set this up?

Here is a “How To” example:

Step 1:

cd to …gddwebapptrunkthirdparty directory

Step 2:

svn propset  svn:externals “JBoss 3_2_6”  .

Step 3:  svn commit

Step 4:  svn update

(This will fetch external item into ‘JBoss 3_2_6’)

JBoss_3_2_6 now appears  in the ../gddwebapp/trunk folder (workspace) as illustrated in Figure A.

Figure A

Upon branching i.e. creating a nick_devel branch, external JBoss_3_2_6  appears in the nick_devel workspace as illustrated below in Figures B and C.

Figure B

Figure C

Previous Article
For What It’s Worth
For What It’s Worth

I’ve used this theme before but I need to once again give my nods to Buffalo Springfield.  It is absolutely...

Next Article
There is method to the madness – but can I rank it?
There is method to the madness – but can I rank it?

So you have a number of super stories or features that must be broken down if they’re going to fit within a...