Introduction
Formatter, Code Templates, etc. can be stored as project specific settings in the folder .settings/
. You don't necessarily need to re-import the Formatter in your workspace.
You can use project specific settings in combination with svn:externals
to "inject" the formatter, code templates, etc. in your projects.
svn:externals:
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.
Projects
- We have a java project named
com.xyz.codeconventions
where we added a project specific formatter and code templates. This project is under version control.
- For all the other projects we define a
svn:externals
property to "inject" the .settings/
folder from the project com.xyz.codeconventions
(This is the folder where the project specific data is stored)
- If you now want to change the formatter you can edit the project
com.xyz.codeconventions
and use svn commit
to submit the changes. The team will have to svn update
on all projects to get the latest version of the code formatter.
Configuration
For all projects which should use this formatter you have to define a svn:externals property.
Example for com.xyz.project1:
key value
---- ------
svn:externals http://path/to/com.xyz.codeconventions/.settings .settings
In Eclipse (in my case Subversive) you can add svn specific properties with Team -> Set property...
.

Repository Layout
The repository structure in our case looks like this:
<root>
|
+-- com.xyz.project1 # (svn:externals -> <root>/codeconventions/.settings .settings)
| |
| +-- src
| +-- <...>
+-- com.xyz.project2 # (svn:externals -> <root>/codeconventions/.settings .settings)
| |
| +-- src
| +-- <...>
+-- com.xyz.codeconventions
|
+-- .settings # (this folder will get "injected" in project1 and project2)
|
+-- org.eclipse.jdt.core.prefs
+-- org.eclipse.jdt.ui.prefs
Additional comments / Limitations
- This approach is for
svn
users only but if you use git
there is something similar to svn:externals named Submodules.
- Make sure that in project1 and project2 are no
.settings/
-folder because with svn:externals
it is not possible to overwrite existing files.
- If you have java projects which need completely different formatters or different files in the
.settings/
folder this approach is probably not what you are looking for. Our projects always have the same .settings
files.
Sources