Reputation: 1332
I have the following structure in the project:
Project -
|- Parent // bunch of abstract classes which are used by children
|- child_A // depend on abstract classes from Parent
|- child_B // depend on abstract classes from Parent
|- child_C // depend on abstract classes from Parent
I would like to build jars both for the parent and children as well. So I would end up with parent.jar, child_*.jar. How can I do this in maven?
Upvotes: 3
Views: 1721
Reputation: 31595
In Maven tree node is always a project with type pom
(project tree definition). Module with type jar
is always a tree leaf (generated product). Tree node are named aggregator projects and requires 'pom' as packaging.
Your project should look like this (3-level as you ask)
+ Project parent (POM)
+ Abstract module (JAR) // bunch of abstract classes which are used by children
+ Implementation Modules (POM)
+ Module A (JAR) // depend on abstract classes from Abstract
+ Module B (JAR) // depend on abstract classes from Abstract
+ Module C (JAR) // depend on abstract classes from Abstract
Abstract Module is configured as dependency in Module A, B and C.
Upvotes: 5