Reputation: 22191
While writing for the first time a multi-modules maven pom, I wonder something.
First, here my parent pom :
...
<modelVersion>4.0.0</modelVersion>
<groupId>project.room_management</groupId>
<artifactId>room_management</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<name>room_management</name>
<modules>
<module>room_management_dao</module>
<module>room_management_domain</module>
<module>room_management_service</module>
<module>room_management_gui</module>
</modules>
...
and one of its children :
...
<parent>
<groupId>project.room_management</groupId>
<artifactId>room_management</artifactId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>project.room_management</groupId>
<artifactId>room_management_domain</artifactId>
<version>1.0</version>
...
Considering I don't need common modules to be share from parent to children poms, can I remove without "risks" the parent declaration into the children poms ? Or Maven does need it for modules compilation ?
Upvotes: 1
Views: 246
Reputation: 97517
In this example you need the parent element, cause you have dependencies between gui and your service (service to dao as well). Furthermore you need to define the dependencies between the modules to see which module uses which. On the other hand maven needs this information to predict the order of build of the modules which is important. The next advantage of having such relationship is you can define the plugins/versions of dependencies in the parent module and many other things.
Upvotes: 1
Reputation: 75426
You do not need the <parent>
section in the modules.
This primarily mean that each module must be independent - you cannot share configuration sections through the parent.
Upvotes: 1