Setting up a Maven proxy server

This page is outdated and no longer receives updates!

Installing the server

For groups of developers working on limited internet connections it may be worth setting up a Maven proxy to reduce the amount of traffic required for Maven development. For this we recommend the Nexus repository manager.

  1. Assuming you have an existing J2EE server, download the latest WAR version of nexus. If not then use can use standalone version that includes the Jetty server.

  2. Deploy to your server (e.g. to http://SERVER:8080/nexus)

  3. Access the application and login with username: admin, password: admin123

  4. Change the admin password by accessing the Security tab on the left of the page

  5. Enable remote indexing for the following repositories: Maven Central, Apache Snapshots, and Codehaus Snapshots

    1. Open the Repositories view from the menu on the left of the page

    2. Select each repository and click on the Configuration tab

    3. Change the setting of Download Remote Indexes to true

  6. Add the OpenMRS Maven Repository as a proxy repository

    1. Select Add... > Proxy Repository from the top menu of the Repositories view

    2. Complete the following fields:

      1. Repository ID = openmrs-repo

      2. Repository Name = OpenMRS Nexus Repository

      3. Remote Storage Location = http://mavenrepo.openmrs.org/nexus/content/repositories/public/

    3. Save and press refresh to tell Nexus to update it's indexes.

  7. Add the OpenMRS proxy to the Public Repositories group.

    1. Select Public Repositories and open the Configuration tab

    2. Select OpenMRS Nexus Repository in the list of available repositories and add to group's list

Configuring your client

To configure your Maven client to use the proxy you must add the following to your settings.xml file (see here for a complete sample):

<settings> ... <mirrors> <mirror> <id>nexus</id> <mirrorOf>central,apache-snapshots,codehaus-snapshots,openmrs-repo</mirrorOf> <url>http://SERVER:8080/nexus/content/groups/public</url> </mirror> </mirrors> </settings>

This will tell Maven to use the new proxy when searching for artifacts from those repositories including the OpenMRS repository. Depending on your version of Maven you may also have to add repository elements for Maven Central as shown here.Â