Using Binary Dependencies

Imagine yourself on a team of several developers with a project made of several Maven subprojects. When you wish to build the Maven subproject you're working on you have two choices: start by building all its dependencies using the Multiproject plug-in (see Chapter 3) or directly build the said subproject assuming that the dependencies have already been built and are available in your Maven remote repository. The first strategy uses source dependencies (in the sense that you build the dependencies from the sources) and the second strategy uses binary dependencies. The latter is very useful on medium to large projects where building all dependent projects on each developer's machine would take too long. It's also extremely useful when you have several teams, each developing a subset of the full application; each team can concentrate on its own code and release the code as a binary artifact to the other teams. This lab will teach you how to set up a binary dependency strategy.

How do I do that?

You know how to create your own remote repository, how to set up a continuous build, and how to deploy project artifacts. Now you have all of the ingredients necessary for implementing a binary dependencies strategy.

Let's go through the architecture of a binary dependencies build strategy (see Figure 5-7) to see what we need to set up:

  • The continuous build runs all the time and builds all subprojects. Whenever it has finished building a project and if the build was ...

Get Maven: A Developer's Notebook 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.