Question

I have a web app project which is now growing in to separate web submodules containing their own ejbs and jsf webpages.

The project structure is going to look like something following.

  • parent-project
  • common-module
  • creditcard-module
  • bankpayment-module
  • some-more-payment-modules ...
  • war-module

Each module except common module has its own ejbs and jsf pages.

If possible I need each module to be a standalone war and build a big war with the war module.

EDIT

Current structure of the project

war module -- 
           --| persistenceunit |
           --| entities |
           --| ejbs |
           --| cdi managed beans |
           --| controllers |
           --| jsf-pages |
           --| resources |

The different business units are just separated by packages. Now it is required to be able to version the different business units separately i.e. different mvn projects for each.

Structure to achieve:

Common module -- 
              --| persistenceunit |
              --| dao helpers |
              --| common ejb services |
              --| common managed beans |                  
              --| jsf-templates |
              --| common resources |
Creditcard module -- 
              --| related entities |
              --| ejb services |
              --| related managed beans |                  
              --| jsf-pages |
              --| specific resources |

And the same for other business modules, moreover one master war / ear module to contain all the wars.

Important: is it possible to share persistence unit ? Will cdi work across the modules (at the end it is a single ear/war) ?

In essence the idea is to modulerise the project according to business needs and not purely technical layers.

How should I achieve this with maven ?

Was it helpful?

Solution

You may be able to accomplish what you want using Maven Web overlays:

http://maven.apache.org/plugins/maven-war-plugin/overlays.html

They let you have Web resources propagate through projects via dependencies, similar to how source files and classpath resources propagate through jar files and into war files via dependencies.

OTHER TIPS

You can create an Enterprise Archive (.ear file) using the Apache Maven EAR Plugin:

A Java EE application is delivered in an Enterprise Archive (EAR) file, a standard Java Archive (JAR) file with an .ear extension. Using EAR files and modules makes it possible to assemble a number of different Java EE applications using some of the same components. No extra coding is needed; it is only a matter of assembling (or packaging) various Java EE modules into Java EE EAR files. (Source: Java EE 5 docs)

Create a new module with packaging ear. Use the maven-ear-plugin, configure the modules that you want to have assembled together.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top