Setting up a Maven2 Internal Repository.

This is going to be a very very dull post unless you are trying to figure out how to set up an internal company repository for maven2. If you are, and you are desperately looking for information on how you do this, then welcome.

I have just spent the morning trying to get a communal internal repository set up for our development environment, and it turns out that there is next to no information available on how to do it. This is mainly because it’s very easy, but still, it would have been a more productive morning if there was a web page somewhere explaining it.

Maven manages your dependencies, and can automatically download various jar files and so on for you. Telling it  “I need to use Junit” for example will cause it to download Junit, and put it on your classpath. It gets files it downloads from a repository.

By default Maven will talk to two repositories. One is the central repository maintained at the Maven site, and the other is a local copy, which will be in the .m2 directory of your home directory.

We wanted to have a something that falls between these two settings; something that all our developers can download from, but isn’t publicly accessible. We use various commercial third party libraries and making them available to the entire world is clearly bad.

It turns out that a maven repository is just a directory somewhere, and that’s about it. In order to use it there are very few steps you need to do.

  1. Choose a directory
  2. Make sure its accessible via some network protocol to everyone who needs it (i.e. serve it via http or ftp or something)
  3. Put the libraries you need in the directory, in a specific format.
  4. Set up your maven builds to read from the repository
  5. (optional) set up your maven builds to deploy your repository

I will assume you know how to do the first two steps. A point of interest about the second step is that to deploy anything to the repository you must use a protocol that supports writing. I suggest scp. In fact I have made the repository available via scp for deployment, and http(s) for reading (makes authentication easier). Our server is going to change only to https soon, and I need to figure out how to get maven to support self signed certificates. At the moment it just dies.

To put existing libraries into the repository, use the maven deploy command.

To set up your build to read from the repository add the following xml to your pom.xml file:


The URL must be accessible for read permission, but write is not required.

Finally, to get your maven build to deploy to the repository, add in:

Description of server

Obviously there are lots of things you can tweak with the xml elements etc. But hopefully this will get you far enough along for the maven2 website’s documentation on xml elements to be of use.

By |April 24th, 2006|General|10 Comments

Work, Flat, Work, Flat

Work is great! I’m not sure if I am weird for saying that, but I think it’s true. OK, so I’ve only been working for 2 weeks so far, and one of those weeks was a bank holiday week, so only 9 days, well, 10 after today. But so far, it’s great. It takes me less than 30 mins to get there, and I get to play with setting up nice software engineering processes in a team that mostly thinks the same way I do about these things, and everyone is fun, and chilled out, and not only have I not been asked to work overtime – at least not yet – I have so far been thrown out of the office by 6pm twice.

More than that, I get a great company deal on the local LA fitness that includes use of all the branches across London for less money than you would normally pay for a small local gym, and I’m moving to a new flat.

For the sake of not jinxing it, I better point out that the flat contract isn’t quite signed yet, but so close that we think we can see all the steps left between now and signing it, the landlord has agreed to us, and we have got a contract, and just have to query some of the fine points. With a bit of luck, and a prevailing wind, we will move in next Monday!

My flatmate, Jess, has christened it the “pole dancing flat” on account of the place just down the road that gives pole dancing classes. It (the flat that is) is the top two floors of a converted Georgian house, with views over the canal, and I even get an en-suite bathroom. Did I mention that its only 10 mins walk from both Angel, which has great night life, and from where I work, so I won’t even have to fight with any public transport?

I guess it’s about time I took off the bit on the front page of my site saying I’m looking for a job…

Next project, get my PhD formatted and published as a paperback book!

By |April 19th, 2006|General|0 Comments