Enterprise Java Development@TOPIC@
The following sketch of two directory structures can be used as a starting point for your overall application. The first is a simplified project layout that collapses the number of sub-projects into a single "Impl" project. It is suggested that you use this layout if you are new to maven and want the simplest configuration possible. The second is a more robust layout and is closer to a multi-developer environment. Use the later structure if you want to better simulate a work environment where the work of multiple developers needs clearer separation.
All "e"Sport, "e"League, and "e"Club names should be changed to your specific name mangler. The same type of modification needs to occur for the java package names.
Other than a README, it is not anticipated that you will have other artifacts at the root layer. The root pom.xml should be used only as a convenience wrapper to perform goals across both projects. The root project can also be used for common property, dependencyManagement, and pluginManagement defintions. All concrete dependency and plugins should be defined in the leaf-level poms to avoid unwanted dependencies from the root or mid-level parents.
Figure 18.1. Single Module Approach Candidate Module Structure
eSport |-- eLeague | +--eLeagueImpl | | |-- pom.xml | | `-- src | | |-- main | | | |-- java | | | | `-- eleague | | | | |-- bo | | | | |-- dao | | | | |-- jpa | | | | |-- bl | | | | |-- blimpl | | | `-- resources | | | `-- ddl | | | |-- eLeague-create.ddl | | | |-- eLeague-drop.ddl | | | `-- (eLeague-tuning.ddl or within create) | | `-- test | | |-- java | | | `-- eleague | | | |-- bo | | | |-- dao | | | `-- bl | | `-- resources | | |-- log4j.xml | | `-- META-INF | | `-- persistence.xml | `-- pom.xml |-- eClub | +--eClubImpl | | |-- pom.xml | | `-- src | | |-- main | | | |-- java | | | | `-- eclub | | | | |-- bo | | | | |-- dao | | | | |-- bl | | | `-- resources | | | `-- ddl | | | |-- eClub-create.ddl | | | |-- eClub-drop.ddl | | | `-- (eClub-tuning.ddl or within create) | | `-- test | | |-- java | | | `-- eclub | | | |-- bo | | | |-- dao | | | |-- bl | | `-- resources | | |-- log4j.xml | | `-- META-INF | | `-- persistence.xml | `-- pom.xml `-- pom.xml
Figure 18.2. Multi-Module Approach Candidate Module Structure
eLeague |-- eLeague | +--eLeagueBO | | |-- pom.xml | | `-- src | | |-- main | | | `-- java | | | `-- eleague | | | |-- bo | | | `-- bl | | `-- test | | |-- java | | | `-- eleague | | | `-- bo | | `-- resources | | `log4j.xml | +--eLeagueDAO | | |-- pom.xml | | `-- src | | |-- main | | | |-- java | | | | `-- eleague | | | | |-- dao | | | | `-- jpa | | | `-- resources | | | `-- ddl | | | |-- eLeague-create.ddl | | | `-- eLeague-drop.ddl | | | `-- (eLeague-tuning.ddl or within create) | | `-- test | | |-- java | | | `-- eleague | | | `-- dao | | `-- resources | | |-- log4j.xml | | `-- META-INF | | `-- persistence.xml | +--eLeagueBLImpl | | |-- pom.xml | | `-- src | | |-- main | | | `-- java | | | `-- eleague | | | `-- blimpl | | `-- test | | |-- java | | | `-- eleague | | | `-- bl | | `-- resources | | `-- log4j.xml | `-- pom.xml |-- eClub | ("it is simple" keep to a single module as shown above) `-- pom.xml
Since the work of project 1 will be deployed to the application server in follow-on projects, the persistence.xml definitions created in project 1 should be considered strictly for test and should be placed in the "src/test" tree to prevent it from being deployed to the application server. It is also suggested that if your persistence unit is called "X", the persistence unit name for project 1 in the "src/test" tree be called "X-test" to avoid confusion of what is intended to be used.