Book Image

Apache Maven Cookbook

Book Image

Apache Maven Cookbook

Overview of this book

Table of Contents (18 chapters)
Apache Maven Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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>
          </dependency>
        </dependencies>
    </dependencyManagement>
  3. Update the dependencies section of the child project...