Enterprise Java Development@TOPIC@
Maven modules boundaries are highly influenced by the re-usable artifacts that must be produced
If you have many .jars, you likely have many maven modules
If you have few but large .jars, you likely have few but large maven modules
If you require different types of artifacts, you likely have different maven modules
Maven can be used in multi-module configuration
Many maven modules share the same configuration needs -- could lead to duplication
POM Inheritance helps mitigate duplication issues
Common properties can be defined in parent pom
<project>
<groupId>info.ejava.examples</groupId>
<artifactId>examples-root</artifactId>
<version>5.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Student Root</name>
<scm>
<url>https://github.com/ejavaguy/ejava-student/tree/master</url>
<connection>scm:git:git@github.com:ejavaguy/ejava-student.git</connection>
<developerConnection>scm:git:git@github-ejavaguy:ejavaguy/ejava-student.git</developerConnection>
<tag>HEAD</tag>
</scm>
...
In the above example -- the parent pom is defining the CM repository for all sub-modules
Child projects can inherit from a parent pom
<project>
<parent>
<groupId>info.ejava.examples</groupId>
<artifactId>examples-root</artifactId>
<version>5.0.0-SNAPSHOT</version>
</parent>
<groupId>info.ejava.examples.javase</groupId>
<artifactId>javase</artifactId>
<packaging>pom</packaging>
<name>JavaSE</name>
...
In the above example, the javase project inherits the CM configuration from the parent
<project>
<parent>
<groupId>info.ejava.examples.ejb</groupId>
<artifactId>ejb</artifactId>
<version>5.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ejbsessionBank</artifactId>
<packaging>pom</packaging>
<name>EJB::Session EJB Bank Example</name>
<description>
This project is the root project for the core session bean example.
</description>
<modules>
<module>ejbsessionBankImpl</module>
<module>ejbsessionBankEJB</module>
<module>ejbsessionBankWAR</module>
<module>ejbsessionBankEAR</module>
<module>ejbsessionBankTest</module>
</modules>
</project>
The example above has several child modules that it will build in the order they are specified.