Chapter 5. Team Collaboration with Maven

You have already discovered how to use Maven locally on your development machine. However, when you're working on a team, new issues arise:

Sharing a Maven Installation

When you're working on a team, it's a good idea to use a common development environment. This way you don't have to constantly struggle to figure out why something that works on your machine doesn't work on that of a colleague. A common development environment also makes it easier to upgrade dependencies and add new features to your shared build and test systems. A common challenge in large workgroups is standardizing on a central build system, and in this lab, you will discover how to share a Maven installation on a development team.

How do I do that?

The first thing to do is to unpack the Maven installation files and place them in a location accessible by everyone. Typically, this can be either a shared drive or an SCM system (in the latter case developers will need to check out the Maven files). A good practice is to make this shared Maven installation read-only; this makes it impossible for developers to introduce errors into files not intended for modification. Let's assume that you now have access to the shared Maven installation files from the c:\apps\maven directory on a Windows machine, or from the /usr/local/maven directory in a Unix environment (you can pick any directory you like).

Now, set your MAVEN_HOME environment variable to point to c:\apps\maven (or /usr/local/maven ...

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.