<p>Currently we have a project with a standard subversion repository layout of:</p>

<p>./trunk<br>
./branches<br>
./tags</p>

<p>However, as we're moving down the road of OSGi and a modular project, we've ended up with:</p>

<p>./trunk/bundle/main<br>
./trunk/bundle/modulea<br>
./trunk/bundle/moduleb
./tags/bundle/main-1.0.0<br>
./tags/bundle/main-1.0.1<br>
./tags/bundle/modulea-1.0.0</p>

<p>The 'build' is still quite monolithic in that it builds all modules in sequence, though I'm starting to wonder if we should refactor the build/repository to something more like:</p>

<p>./bundle/main/trunk<br>
./bundle/main/tags/main-1.0.0<br>
./bundle/main/tags/main-1.0.1<br>
./bundle/modulea/trunk<br>
./bundle/modulea/tags/modulea-1.0.0  </p>

<p>In this pattern I would imagine each module building itself, and storing its binary in a repository (maven, ivy, or another path of the subversion repository itself).</p>

<p>Are there guidelines or 'best-practices' over project layouts once one goes modular?</p>

[{'answer_id': 14427, 'author': 'Anders Sandvig', 'author_id': 1709, 'author_profile': 'https://Stackoverflow.com/users/1709', 'pm_score': 3, 'selected': False, 'text': "<p>This is very much up to personal preference, but I find the following structure suitable for large projects consisting of many modules:</p>\n\n<pre>\nbranches\n  project-name\n    module1\n      branch-name\n    module2   \n      possibly-another-branch-name\n    branch-name-on-a-higher-level-including-both-modules\n      module1\n      module2\ntags\n  ... (same as branches)\ntrunk\n  project-name\n    module1\n    module2\n</pre>\n\n<p>I have also often used the structure in large repositories containing many projects, because keeping all projects in the same repository makes cross-referencing projects and sharing code between them&mdash;with history&mdash;easier.</p>\n\n<p>I like to use the structure with root trunk, tags and branches folders from the start because in my experience (with large repositories containing many projects), many sub-projects and modules will never have separate tags or branches, so there is no need to create the folder structure for them. It also makes it easier for the developers to check out the entire trunk of the repository and not get all the tags and branches (which they don't need most of the time).</p>\n\n<p>I guess this is a matter of project or company policy though. If you have one repository for each project or a given developer is only likely to work on a single project in the repository at a time the rooted trunk may not make as much sense.</p>\n"}, {'answer_id': 14441, 'author': 'Sören Kuklau', 'author_id': 1600, 'author_profile': 'https://Stackoverflow.com/users/1600', 'pm_score': 4, 'selected': True, 'text': '<p>The Subversion book contains two sections on this:</p>\n\n<ul>\n<li><a href="http://svnbook.red-bean.com/en/1.4/svn.branchmerge.maint.html#svn.branchmerge.maint.layout" rel="nofollow noreferrer">Repository Layout</a></li>\n<li><a href="http://svnbook.red-bean.com/en/1.4/svn.reposadmin.planning.html#svn.reposadmin.projects.chooselayout" rel="nofollow noreferrer">Planning Your Repository Organization</a></li>\n</ul>\n\n<p>A blog entry on the subject: <a href="http://blogs.collab.net/subversion/subversion_repo" rel="nofollow noreferrer">"Subversion Repository Layout"</a></p>\n\n<p>The short answer, though: while your mileage will vary (every situation is individual), your <code>/bundle/&lt;project&gt;/(trunk|tags|branches)</code> scheme is rather common and will likely work well for you.</p>\n'}, {'answer_id': 17574, 'author': 'Boris Terzic', 'author_id': 1996, 'author_profile': 'https://Stackoverflow.com/users/1996', 'pm_score': 0, 'selected': False, 'text': '<p>I\'ve answered a similar question in a StackOverflow <a href="https://stackoverflow.com/questions/16829/structure-of-projects-in-version-control#16915">Version Control Structure question</a>. It actually fits even better here since we do heavy OSGi development and have lots of bundles. I must echo Anders Sandvig comments: keep trunk/tags/branches on the root level since you will only branch a limited set of modules. It also does not interfere with modules building individually.</p>\n\n<p>I won\'t copy the answer I made before but it is entirely relevant to this question.</p>\n'}, {'answer_id': 610268, 'author': 'Chucky', 'author_id': 73643, 'author_profile': 'https://Stackoverflow.com/users/73643', 'pm_score': 2, 'selected': False, 'text': '<p>Just my two cents...</p>\n\n<p>I just want to emphasize the comment in the SVN documentation (already quoted in another answer, same thread) <a href="http://svnbook.red-bean.com/en/1.4/svn.reposadmin.planning.html#svn.reposadmin.projects.chooselayout" rel="nofollow noreferrer">http://svnbook.red-bean.com/en/1.4/svn.reposadmin.planning.html#svn.reposadmin.projects.chooselayout</a></p>\n\n<p>The excerpt references the following structure :\n/\n   trunk/\n      calc/\n      calendar/\n      spreadsheet/\n      …\n   tags/\n      calc/\n      calendar/\n      spreadsheet/\n      …\n   branches/\n      calc/\n      calendar/\n      spreadsheet/</p>\n\n<p>"There\'s nothing particularly incorrect about such a layout, but it may or may not seem as intuitive for your users. Especially in large, multi-project situations with many users, those users may tend to be familiar with only one or two of the projects in the repository. But the projects-as-branch-siblings tends to de-emphasize project individuality and focus on the entire set of projects as a single entity. That\'s a social issue though. We like our originally suggested arrangement for purely practical reasons—it\'s easier to ask about (or modify, or migrate elsewhere) the entire history of a single project when there\'s a single repository path that holds the entire history—past, present, tagged, and branched—for that project and that project alone."</p>\n\n<p>For my own, I tend to agree quite strongly with this and prefer the following layout:\n/\n   utils/\n      calc/\n         trunk/\n         tags/\n         branches/\n      calendar/\n         trunk/\n         tags/\n         branches/\n      …\n   office/\n      spreadsheet/\n         trunk/\n         tags/\n         branches/</p>\n\n<p>The reason are simply that its impractical to tag a complete project set when one would want to tag only a specific subset.</p>\n\n<p>Let\'s use an example: If project-1 depends on moduleA v1.1 and moduleB v2.3, I don\'t want newer moduleA v2.x to appear in the tags. In fact, when coming back some days/weeks/months later to this tagged release, I would be forced to open the bundle descriptor in the tagged version of project-1 to read the version of moduleA actually required.</p>\n\n<p>Moreover, if I have to make a specific backup of this release\'s sources onto a CD, I just want to export this tag without downloading hundreds of megabytes of unrelated stuff.</p>\n\n<p>It was just my two cents.</p>\n'}]
['https://Stackoverflow.com/questions/14397', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1720/']