Edi Weissmann

I code for fun /* and profit */

Free Private Maven Repository Hosting

Apache Maven

This article will show how to host a private Maven repository for free using Dropbox.

A foreword about privacy of the repository created using this solution: it’s not completely private. It’s private enough. If somebody guesses the name you gave to your repository and the name of the artifacts, then they could get access to them. For me that’s not a problem. Just name your repository something very random, like a good strong password.

If you don’t need a private Maven repository, you should probably know the nice people at Sonatype offer free public Maven repository hosting for open source projects. Read more about it here.

To start, get a Dropbox account. Inside it, in the Public folder, you’ll be storing the maven artifacts.

Then you’ll also need the Dropbox desktop client for uploading the files from the local filesystem to the Dropbox servers.

With the Dropbox desktop client setup, you should have a path on your local filesystem where the Public folder is synchronized to. Mine is /Users/edi/Dropbox/Public.

All we need to do now is to tell Maven to deploy the artifacts of the project to this path:

1
mvn deploy -DskipTests=true -DaltDeploymentRepository=dropbox::default::file:///Users/edi/Dropbox/Public/repository

If you prefer a more permanent solution, just add the following lines to your pom.xml:

1
2
3
4
5
6
<distributionManagement>
      <repository>
          <id>dropbox.repo</id>
          <url>file:///Users/edi/Dropbox/Public/repository</url>
      </repository>
  </distributionManagement>

That’s it. After deploying you’ll need to wait few minutes for Dropbox to upload all the files to the cloud.

To get the url of your private maven repository, log into Dropbox, select your Public folder and click Copy public link. You should get something similar to https://dl.dropboxusercontent.com/u/123456/repository.

Done, your new Maven repository is ready to use! And remember, it’s not completely private. Use it only if for you it’s private enough.


Note: The Dropbox links in this article contain referral information. If you sign up using that link we’ll both get 500 MB of bonus space.