Search code examples
javaweb-applicationsproject-structure

how to start a new project


For the first time ever I am getting the chance to start a new project.

I am comfortable with structure of the project with regards to the 'development'. It has the usual 'src', 'lib', 'resources', 'test', etc dirs. I already have this structure in the Eclipse project.

I am unable to decide what should be the dir structure in the source control. I am currently thinking the following:

/sourcecontrol/branch/MyProject:
-dev
---- Here I will have dirs that make up the 'Eclipse' project.
-dbscripts
---- sql Scripts for any DB Schema change
-documentation
---- UserGuide.pdf
---- DeveloperGuide.pdf
---- Other such docs
-sh
---- Here I will have the scripts to deploy, start, and stop the web server.
-notes
---- Here I will store random 'helpful notes' that developers can create for other developers. 

The idea is that when somebody wants to just 'develop' the project, they can check out only the 'dev' dir.

Is this a good idea? Any suggestions from your past experience? I have been unable to find 'best practices' for a new project that don't talk about 'src', 'test', 'lib', etc.

EDIT: If it helps, its a java spring+hibernate webapp

EDIT2: This is my concern as of now: Should the Eclipse project structure be the project structure in Source countrol too? If so, then the base dir of the Eclipse project, will become the base dir of the source control project too


Solution

  • A few notes:

    • Avoid checking in IDE config.
    • Use Maven style layout for source code (src/main/java, src/test/java)
    • SQL can also be organised in a similar style i.e. src/main/sql.
    • Depending on the complexity of the project consider separate modules (jars) for API, implementation, SQL, installer etc. Maven has built in support for multi-module projects: