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.
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.
Deploy to your server (e.g. to http://SERVER:8080/nexus)
Access the application and login with username: admin, password: admin123
Change the admin password by accessing the Security tab on the left of the page
Enable remote indexing for the following repositories:Â Maven Central, Apache Snapshots, and Codehaus Snapshots
Open the Repositories view from the menu on the left of the page
Select each repository and click on the Configuration tab
Change the setting of Download Remote Indexes to true
Add the OpenMRS Maven Repository as a proxy repository
Select Add... > Proxy Repository from the top menu of the Repositories view
Complete the following fields:
Repository ID = openmrs-repo
Repository Name = OpenMRS Nexus Repository
Remote Storage Location = http://mavenrepo.openmrs.org/nexus/content/repositories/public/
Save and press refresh to tell Nexus to update it's indexes.
Add the OpenMRS proxy to the Public Repositories group.
Select Public Repositories and open the Configuration tab
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.Â