Reputation: 611
We have maven aggregated pom project as below
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.abc</groupId>
<artifactId>project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>module-1</module>
<module>module-2</module>
<module>module-n</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.xyz<groupId>
<artifactId>framework</artifactId>
<version>1.1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.xyz</groupId>
<artifactId>dao</artifactId>
<version>1.1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
module-2 has dependency of module-1 AND module-n has dependency of module-1 & module-2.
The maven reactor can resolve all inter-module dependency (build order is module-1, module-2, module-n).
Some shared components from com.xyz is also used by the modules (e.g. framework). They are retrieved from the remote artifactory server, while the inter-module dependency artifacts (e.g. module-1.jar) are retrieved locally during maven build.
My question is what is the best way to associate the dependencies. By module or by the artifacts stored in artifactory server? This example has both usage. I could not figure out under which circumstance we should
1) group all inter-dependent modules under the same parent pom OR
2) always pull the depending artifacts from remote artifactory repo and let each of the module built independently
Any pros and cons? Sorry for my poor English. I hope my question is clear. Thank you!
Upvotes: 4
Views: 239
Reputation: 35823
The rule of thumb is:
Do you always build the jars at the same time? Then they should form a multi-module project.
Upvotes: 1