I have project which consists of two separate sub-projects and some common code, with the sub-projects needing to be built independently.
What would be the recommended Maven project structure for this scenario?
I've already tried something like this:
-project-parent
-pom.xml
-projectA-parent
-pom.xml
-projectA
-pom.xml
-projectB-parent
-pom.xml
-projectB
-pom.xml
-common
-pom.xml
The parents for A and B are responsible for building the modules projectA/common and projectB/common. In the project parent POM I would define some common dependencies.
Is there an alternative that does not use a parent hierarchy? Something that, e.g., uses build profiles which can be used to build either projectA or projectB with their dependencies (common)?