<p>I am going to be using Subversion for source control on a new J2EE web application. What directory structure will you recommend for organizing code, tests and documentation?</p>

[{'answer_id': 41524, 'author': 'Mendelt', 'author_id': 3320, 'author_profile': 'https://Stackoverflow.com/users/3320', 'pm_score': 4, 'selected': False, 'text': "<p>I usually have</p>\n\n<pre>\nProject Directory\n  src - actual source\n  doc - documentation\n  lib - libraries referenced from source\n  dep - installation files for dependencies that don't fit in lib\n  db  - database installation script\n</pre>\n\n<p>In work with Visual Studio, I'm not sure if this works the same in the java world. But i usually put stuff in different project folders in src. For each source project there's a separate test project. Build files go in the main project directory. I usually put a README there too documenting how to setup the project if it needs more than just checking out.</p>\n\n<p>EDIT: This is the structure for a single working checkout of the project. It will be duplicated for each branch/tag in your revision control system (remember, in most SVN system, copies are cheap). The above example under Subversion would look like:</p>\n\n<pre><code>/project\n    /trunk\n        /src\n        /doc\n        /...\n    /branches\n        /feature1\n            /src\n            /doc\n            /...\n        /feature2\n            /src\n            /doc\n            /...\n</code></pre>\n"}, {'answer_id': 41536, 'author': 'onnodb', 'author_id': 1037, 'author_profile': 'https://Stackoverflow.com/users/1037', 'pm_score': 2, 'selected': False, 'text': '<p>I found some old questions here on SO that might be interesting for you:</p>\n\n<ul>\n<li><a href="https://stackoverflow.com/questions/5214/whats-a-good-standard-code-layout-for-a-php-application">Whats a good standard code layout for a php application</a>\n\n<ul>\n<li>Contains a link to an article on <a href="http://phpimpact.wordpress.com/2008/08/11/scalable-and-flexible-directory-structure-for-web-applications/" rel="nofollow noreferrer">Scalable and Flexible Directory Structure for Web Applications</a> (focus on PHP, though)</li>\n</ul></li>\n<li><a href="https://stackoverflow.com/questions/7596/how-to-structure-a-java-application-in-other-words-where-do-i-put-my-classes">How to structure a java application, in other words: where do I put my classes?</a></li>\n<li><a href="https://stackoverflow.com/questions/16829/structure-of-projects-in-version-control">Structure of Projects in Version Control</a></li>\n</ul>\n'}, {'answer_id': 41539, 'author': 'ryan', 'author_id': 2454, 'author_profile': 'https://Stackoverflow.com/users/2454', 'pm_score': 0, 'selected': False, 'text': '<p>I use Eclipse for creating J2EE web applications and this will create the following project structure:</p>\n\n<pre><code>WebAppName\\\n    \\lib\n    \\src\n    \\tests\n    etc...\n</code></pre>\n\n<p>I would then create an SVN folder on our trunk called WebAppNameProject. Within this folder I would create folders called WebAppNameSource, Documentation etc. Within the WebAppNameSource folder I would place the project source generated by Eclipse. Thus I would have the following folder structure in SVN:</p>\n\n<pre><code>\\svn\\trunk\\WebAppNameProject\n    \\WebAppNameSource\n        \\lib\n        \\src\n        \\tests\n        etc...\n    \\Documentation \n</code></pre>\n\n<p>Hope this helps.</p>\n'}, {'answer_id': 41571, 'author': 'matt b', 'author_id': 4249, 'author_profile': 'https://Stackoverflow.com/users/4249', 'pm_score': 2, 'selected': False, 'text': '<p>To expand on what Mendelt Siebenga suggested, I would also add a <code>web</code> directory (for JSP files, WEB-INF, web.xml, etc). </p>\n\n<p>Tests should go in a folder named <code>test</code> that is a sibling of the main <code>src</code> folder - this way your unit test classes can have the same package name as the source code being tested (to ease with situations where you want to test protected methods or classes, for example... see the <a href="http://junit.sourceforge.net/doc/faq/faq.htm#tests_10" rel="nofollow noreferrer">JUnit FAQ for this</a>, and this question also on <a href="http://junit.sourceforge.net/doc/faq/faq.htm#organize_1" rel="nofollow noreferrer">Where should I put my test files?</a>).</p>\n\n<p>I haven\'t had much use for it myself, but a Maven project will also create a <code>resources</code> folder alongside the src folder for non-source code that you want to package/deploy along with the main source code - things such as properties files, resources bundles, etc. Your mileage may vary on this one.</p>\n'}]
['https://Stackoverflow.com/questions/41513', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']