4

I'm building a multi-modules J2EE web application by Maven. The web business application contains several sub-systems / modules. To get high modularity, easy-for-distributed-team-development, easy code navigation, easy deployment and upgrading, we seperates the web business application system by features, and then by layer. Here's maven hierarchy:

|--business-sub-system-1
|    --domain
|       --pom.xml
|    --dao
|       --pom.xml
|    --service
|       --pom.xml
|    --webapp(presentation)
|       --pom.xml
|--pom.xml
|
|--business-sub-system-2
|    --domain
|       --pom.xml
|    --dao
|       --pom.xml
|    --service
|       --pom.xml
|    --webapp(presentation)
|       --pom.xml
|--pom.xml
|
|--business-sub-system-3
| ...
|--business-sub-system-4
|...
|--business-sub-system-5
|...
|...
|pom.xml

but we have to share the webapp because the whole project will be treated as one web project ( one web.xml).

enter image description here

My question is how to seperate the webapp into different modules but can run as one website? (Each business sub-system has individual webapp/html/jsp/js/css, but can merge as one website at runtime)

xoyoja
  • 436
  • 1
  • 5
  • 18

1 Answers1

1

Thinking about this, the best advice I have for you is: deploy separately what a separate team builds. If these sub-systems really need to be independent from each other, and can be released independently it makes no sense at all to deploy them together all at once.

If that is not possible because of the requirements of your system, the best solution in terms of architecture would be to combine the front-end layer in one WAR component, which is dependent on the different business-sub-systems (domain, dao and service). The teams need to share this component but can separate their work across e.g. different folders or packages.

Having said this, life in consulting is often not that easy that logical solutions are possible just like that. So here is my more down-to-earth answer:

In the main POM file, use the assembly-plugin to create a layover war of all the projects. To reduce the complexity of the assembly, you can include the domain, dao, and service POMs as simple dependencies.

Henk de Vries
  • 748
  • 7
  • 8
  • Thank you. If we combine the front-end layer in one war component, let's assume team 1 is developing sub-system1 without front-end, how can the team deploy sub-system1 independently? Use pom.xml of sub-system1 building a jar? or need to re-package the front-end war? – xoyoja Aug 09 '13 at 03:44
  • The point is that the WAR needs to be shared, so you will have to deploy your work together. So everybody will use the same WAR file to test their (backend) work, it will just be that I expect that your teams will develop and test different functionality. Yes, some collisions may occur but ... if these collisions will occur but they will occur anyway :-) So from that perspective using the same WAR is just an example of good risk management. – Henk de Vries Aug 09 '13 at 11:28