The Maven Cookbook

10.. Proxying a Remote Repository

10.. Proxying a Remote Repository

10..1. Task

You and your team or organization are heavy users of remote repositories. Every time a user installs a development environment, they end up downloading data directly from the remote repository. You want to create a caching proxy of the remote repository that will increase the speed of your builds and give you some stability in case the remote repository is unavailable.

10..2. Action

To configure a new Proxy repository, open the Repositories panel by clicking on Repositories under Views/Repositories section of the Nexus menu. Clicking Repositories should display the Repositories panel shown in Figure 10.4, “Opening the Repositories Panel”.

Opening the Repositories Panel

Figure 10.4. Opening the Repositories Panel


To create a new proxy repository, click on the Add... button and select Proxy Repository from the dropdown as shown in Figure 10.5, “Creating a New Proxy Repository”.

Creating a New Proxy Repository

Figure 10.5. Creating a New Proxy Repository


When you create a new proxy repository, you'll need to choose a Repository ID. A Repository ID is an internal identifier which is used in the URL that you will connect your clients to. The standard for Repository IDs is to use a lower case word or words separated by a hyphen. Examples of valid Repository IDs are: "central", "internal", and "custom-snapshots".

Other important fields in the form shown in Figure 10.5, “Creating a New Proxy Repository”, are: Repository Policy, Remote Storage Location, and Download Remote Indexes. The repository policy controls what artifacts can be stored in a repository: snapshot artifacts or release artifacts. The Remote Storage Location is the URL of the remote repository, and Download Remote Indexes tells Nexus to download an index that will enable searching and browsing from the remote repository.