IntelliJ Java IDE
The moose likes Ant, Maven and Other Build Tools and the fly likes Q for Mike Clark: Project Directory Structure Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "Q for Mike Clark: Project Directory Structure" Watch "Q for Mike Clark: Project Directory Structure" New topic
Author

Q for Mike Clark: Project Directory Structure

Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 974
Dear Mike,

A couple of days ago I had to reconsider my
original choice for project directory
structure which I had based on the structure
proposed in the paper 'Ant in anger'.

This change of structure was 'forced' in order
to facilitate the checking out of the project
in the IDE we're using at work. Now it matches
the default naming scheme that the IDE uses,
and therefore there is less fiddling around with
the settings each time a project is checked out.

Project directory structure is essential and
company wide the same structure allows for
an ordered administration. What are your tips
with respect to this issue?

Cheers,

Gian Franco

[ September 21, 2004: Message edited by: Gian Franco Casula ]
[ September 21, 2004: Message edited by: Bear Bibeault ]

"Eppur si muove!"
Mike Clark
author
Ranch Hand

Joined: Aug 15, 2003
Posts: 83
Originally posted by Gian Franco Casula:
Project directory structure is essential and
company wide the same structure allows for
an ordered administration. What are your tips
with respect to this issue?


Well, it's a shame you had to conform your project structure around an IDE. I'd prefer to have the structure suited for humans rather than machines.

In terms of fiddling around each time the project is checked out, Eclipse, for example, generates a .classpath file with directory references that are relative to the project's root directory. This means you can check in the .classpath file and everyone on the project who uses Eclipse can share the same file. That is, when you check out the project and load it into Eclipse, you don't have to fiddle with anything.

In the book, I use this project directory structure:



This has worked quite well for me. It keeps my tests separated from my production source files, but not too far away. Using Megg, a simple directory templating tool, I created a template for the directory structure in the book. It's useful for creating the same, consistent structure each time you start a new project. You can read about it and download the template at:

http://www.pragmaticautomation.com/cgi-bin/pragauto.cgi/Build/ProjectTemplate.rdoc

Consistency is the key, and there's no "right" structure for every project. So please feel free to alter the template to match your company's directory structure of choice.

I hope those are the types of tips you were looking for. If not, please ask again.

Mike

[ September 21, 2004: Message edited by: Mike Clark ]
[ September 21, 2004: Message edited by: Mike Clark ]

Mike Clark<br />Author of <a href="http://www.amazon.com/exec/obidos/ASIN/0974514039/ref=jranch-20" target="_blank" rel="nofollow">Pragmatic Project Automation</a>
Craig Demyanovich
Ranch Hand

Joined: Sep 25, 2000
Posts: 173
I'll second Mike's tips. Before reading his book, I was using something close to what he presents. After reading his book, I combined his best practices with what I was using for a very nice layout, and I've used Megg to make it easy to begin each new project. The book, the link he provided and knowledge of what works well in your environment are all that you need to automate the layout of new projects forevermore.

Craig
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Mike Clark:
Well, it's a shame you had to conform your project structure around an IDE. I'd prefer to have the structure suited for humans rather than machines.


Agreed in general, though sometimes it's the most pragmatic thing to do.

For example, our project is comprised of quite a bunch of CVS modules/Eclipse projects. Until recently, they were organized hierarchically (with the leaves being the actual modules):



Problem was: when creating a new Eclipse workspace, you had to manually specify the directory for each module. When using a Team Project Set, you had to *move* the projects to the correct folders. With the typical size of our workspaces, this alone could take hours!

Now that we are using a flat directory structure, creating a new workspace is a no-brainer...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
IntelliJ Java IDE
 
subject: Q for Mike Clark: Project Directory Structure
 
Threads others viewed
Q about Servlets (3): pro/cons of servlet container types?
Mock question about assert..
Interface question from JQPlus
Q about WSAD & CVS: projectfolders
Q for Mike Clark: tagging the release
IntelliJ Java IDE