Fossil
Fossil

Reputation: 167

Package structure for Spring MVC project with multiple sub projects using Maven

We want to create a spring MVC project using maven. We want to use just one project and, under it, have multiple sub-projects

What would be a good directory/package structure for the project for example

com
    company
        subproject_1
            controller
            doa
            service
            entity
        subproject_2
            controller
            dao
            service
            entity
        

or all files of sub projects in one project

com
    company
            controller
                all controllers of all sub projects 
            doa
                all dao of all sub projects
            service
            entity      

depending on the experience which project structure would be maintainable if the project increases and sub projects keeps adding on

or suggestion of any other package structure?

also what is the naming standard used for directory is it entity or domain? doa or persistence?

Upvotes: 0

Views: 3993

Answers (3)

dimitrisli
dimitrisli

Reputation: 21381

Why not following a multi-module project structure to group your sub-projects? It's a good coding practise widely adopted, recognised and easily manageable. Have a look at this example.

As far as the naming conventions goes that's personal preference but it's good idea to clearly maintain in package structure the different layers as you are saying from botton-top approach: the dao level, the domain, the service layer, the controllers and finally the view.

Upvotes: 1

Andrius Ju
Andrius Ju

Reputation: 56

  1. Create maven multimodule project.
  2. In each project two options:

    • package by feature
    • package by layer

    these options discussed here: http://www.javapractices.com/topic/TopicAction.do?Id=205

My personal approach is to create in each maven module project packages by feature and some "util" packages used by "feature" packages.

Upvotes: 0

Kiara
Kiara

Reputation: 25

Try to use the add to working set option.

Upvotes: 0

Related Questions