5.1. Sharing a Maven InstallationWhen 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. 5.1.1. 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 on Unix) and have your PATH environment variable point to MAVEN_HOME/bin. Figure 5-1 shows a Maven installation shared between two usersVincent and Tim. Figure 5-1. Sharing a Maven installation between two development members (Vincent and Tim)5.1.2. What just happened?You have just shared a Maven installation. The core Maven files are the same ones used by everyone, and all your user-specific local Maven files are located on your machine in a .maven directory located in your home directory. Your .maven directory contains the following subdirectories:
Note: In Maven 2 there's no longer a notion of unpacking plug-in JARs, nor of a cache directory. Plug-ins are accessed directly from the repository. |