Proxying and hosting a Maven repo

A common question is how can I proxy a Maven repo in my company so all developers don’t need to go out to the internet to download the same thing over and over, and having a place to put the internal private artifacts.

The answer is easier than ever. Use Archiva, it has a proxy, webdav accessible repository, search, reports,… It hasn’t been released in Apache yet but you can get a built version by downloading Mergere Maestro (don’t worry it’s open source).

You just need to add in your ~/.m2/settings.xml

<mirrors>
  <mirror>
    <url>http://localhost:8080/archiva/proxy</url&gt;
    <id>myhost.com</id>
    <name>Archiva Repository</name>
    <mirrorof >*</mirrorof>
  </mirror>
</mirrors>

Today’s picture from my Paris trip, the pyramid of Le Louvre (a scar on the face of Paris as some people say 😉 ), more pictures in flickr.

Le Louvre

10 thoughts on “Proxying and hosting a Maven repo

  1. That depends what is your “production” use 😉 but yes I can tell you several companies are already using it.

    Re: maven-proxy, it’s no longer being developed (i did the last release to fix some bugs) and Archiva has its functionality already.

  2. Hi Carlos,

    having a proxy is really valuable. But what I really would like maven be able to do, is to use the file system instead of a remote repository (even if it’s a proxy). Is there a simple way to do that?

    I mean : I want to declare a ‘jars’ directory within the top level project where I will put all my jars, and I want to get maven use this directory as a repo. The very same with plugins. Is it possible ? (yes, it makes sense in many way not to rely on remote repos, but I wont argue about this aspect here 😉

    Regards,
    Emmanuel

  3. Hi Emmanuel, I’ve seen what you have described done. In short, you declare 2 repositories in maven settings. The first can be a local repository on a file (possibly networked) system. The second repository can be the proxy.

    HTH

  4. Thanks Ceki !

    But this is not what I want to do, because it forces users to modify their Maven settings. I want the project to be totally standalone, with a very basic maven install. Actually, I want the FS repo being declared in the toplevel pom.xml.

    Is it possible ?

  5. Not easily. It’s a feature that really few people want. You may try declaring the repo in the top pom with id=central and using a relative path, but I can’t guarantee you that it’s gonna work

  6. ok, thanks for the info Carlos. I’m going to test it and I will give you a feedback.

    I’m really surprised that only a few people is asking for this essential feature which is a must if you want to manage configurations. The idea is to version the jars and plugins repo within the projects sources, guaranteing that you will be able to build a version X.Y.Z of your product, even in 3 or 4 years. You just have to store a big tar.gz of all the files somewhere, and even if ibibio.org is offline, of if mergere company as vanished, you can be sure that it will work with the very same jars and plugins.

    In every big companies in which I have worked, this is mandatory to be able to do that.

    Emmanuel

  7. Backup and configuration management are just two different things. It does not solve the problem of a client who need to download a version and build it right away. And what if I manage 3 or 4 different versions ? Do I have to restore them? Then I will have to manage the backups, which is obviously something that is never done correctly…

    Why trying to do by hand what a tool can do for you? It should not be that complicated to add the feature I need to maven, no? It would be just perfect ! And talking about installing a proxy, I just think it would be so much easier to just use the FS as a storage, because the ‘proxy’ will just be to use file access – even if the FS is on a remote server -. This is just what I need : a FS proxy.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s