The parent project of the multiple module web application uses the uses the
<packaging>pom</packaging> tag and several
<module> tags to indicate that it is controlling the build order of several artifacts. The control is provided through the reactor plugin.
The file structure that I use is:
The ear directory is empty (except for pom.xml). The application.xml required for an EAR is generated by the was6 maven plugin. The directory structure of the web directory is not shown here but specified as the maven standard directory layout.
There are several fields in the various hidden control structures that must be internally consistent for the build and deploy to work. This is why I prefer to use a maven archetype (created yourself for your project team) project to generate web application projects from scratch. My experience in the field indicates that developers who copy and paste from existing projects often make mistakes which are very hard to diagnose.
These are the items that you need to address:
- Provide unique namespace (groupId + artifactId) for ear and war modules that is predictable. I solve this by using parent groupId appended with .war or .ear for the child projects.
- Ensure the parent/child relationship of the three pom.xml files through dependencies and parent references including the correct generated ids.
- Ensure ibm-web-ext.xml and ibm-web-bnd.xml are included in the web module.
- Ensure the .project and .classpath files include the correct RAD facets and library definitions for a maven project.
- Ensure the parent pom.xml has a parent reference to a project that defines the required WAS dependencies (for proper compilation).