Pages

Thursday, June 30, 2011

Sharing Maven local repository with DropBox

Maven stores copies of libraries your projects depend on in to a local directory called local repository. Making this repository available to all the developers in your team can be beneficial, especially if you have multiple manually added libraries (for example Andengine doesn’t have a Maven repository so the libraries need to be manually added to your local repository.
Easy and free way of sharing this local repo is:
  1. All developers register and install Dropbox.
  2. You create a localRepository directory under your Dropbox folder.
  3. You share the localRepository folder to rest of your developers.
  4. All developers configure their Maven to use the Dropbox folder as their localRepository.
Location of your local Maven repository can be configured in settings.xml, either in the <user_home>/.m2 directory, or in the <maven installation>/conf directory. You need to add a new <localrepository> tag. For example:
<settings>  
...
<localrepository>C:/Users/someone/Documents/My Dropbox/localRepository</localrepository>
...
</settings>

That’s it! Thanks Eric Lefevre-Ardant for the tip on changing the repo location.