Performing multi-module dependency management

Dependency management is a mechanism to centralize dependency information. When there are a set of projects (or modules) that inherit a common parent, all information about the dependency can be put in the parent pom and the projects can have simpler references to them. This makes it easy to maintain the dependencies across multiple projects and reduces the issues that typically arise due to multiple versions of the same dependencies.

How to do it...

  1. Open a multi-module project (simple-multi-module).
  2. Add a dependency for junit in the dependencyManagement section:
    <dependencyManagement> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> ...

Get Apache Maven Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.