SVN:Externals - Setting In CFEclipse/Subclipse

Have you used svn:externals yet? From the SVN book online:

Sometimes it is useful to construct a working copy that is made out of a number of different checkouts. For example, you may want different subdirectories to come from different locations in a repository, or perhaps from different repositories altogether. You could certainly setup such a scenario by hand—using svn checkout to create the sort of nested working copy structure you are trying to achieve. But if this layout is important for everyone who uses your repository, every other user will need to perform the same checkout operations that you did.

Fortunately, Subversion provides support for externals definitions. An externals definition is a mapping of a local directory to the URL—and possibly a particular revision—of a versioned resource.

At work - I have the following setup in Subversion:

While I could checkout /trunk and setup my webserver to point to the /coldfusion directory this wouldn't be exactly the same as my production environment. I need to checkout the /coldfusion directory. This leaves my build, testing and other directories left out. By using svn:externals I can grab those directories as well during checkout.

Note: Be aware there are several issues with svn:externals regarding update/commits of code included in the external directories. Please read the related documents online (and if you have Tortoise SVN installed check out the section related to svn:externals in their excellent HELP section - it is listed under the "How Do I..." section in "Include a common sub-project").

svn:externals - checkout

Now lets see how to setup svn:externals using CFEclipse. First if you haven't already - we'll checkout a copy of our project. Here I'm checking out a my /coldfusion subdirectory which contains my project code.

Here is the project in the CFEclipse Navigator view. You can see the path reflected (core/trunk/coldfusion). Now I need to add the other directories (build, testing, etc)

Navigator view

Now we can right click on the top level of our project - select Team > Set Property.

Set Property

The svn property dialog will appear. For the property name select svn:externals. Make sure "Enter a text property" is selected and enter the following (alter this path to match what you want to include):


The svn:property consists of two items - one the name - here I'm using 'oracle' and the full path to the repo. We can define several of these so we'll end up with:



External directories Click OK and you will return to the Navigator view and your svn icon will have changed to let you know things are out of sync. Commit then Update your project (Team > Commit / Update) and you should now see your external directories!

Again please note there are some things to be aware of regarding updating and commiting changes in the external directories. From the Tortoise SVN Help:

Each time you update your main working copy, you will also receive the latest version of all external projects.

If the external project is in the same repository, any changes you make there there will be included in the commit list when you commit your main project.

If the external project is in a different repository, any changes you make to the external project will be notified when you commit the main project, but you have to commit those external changes separately.

While in this example I am using CFEclipse and Subclipse you should be able to follow similar steps using any tool that works with Subversion.