Hosting Maven Sites & Repos at Google Code

by Dana H. P'Simer

Sat, Aug 14, 2010

When hosting an Open Source software project you want to keep things simple and cheap. I was struggling to figure out where I was going to put my SNAPSHOTs and site for a simple BOM striping plugin I had written and was hosting at Google Code. I came across this article but it assumes you are going to use Subversion. I prefer Mercurial so I came up with a similar method.

What I came up with was this: Since Google uses http/https to access the Hg repository, I decided a similar arrangement would work. However with Hg you don't push revisions directly to the remote repo. First they have to go into the local clone then they get pushed. For Hg based projects Google Code provisions two source repositories: one for the wiki and one for the code. So I decided to use the wiki source repo to hold the maven repo and site.

To see the entire project source code and layout go to The Google Code Site for the Strip BOM Maven Plugin. The following are a set of steps that should help you use the same strategy in your project:

  1. In order to know where the local wiki repo directory is, I needed a property to hold that value and then we would set it in the settings.xml, however I am a fan of not having any external dependencies that could cause the build to fail. So I added this to my POM to set a default:
  1. Next I added the following to my POM to define the distributionManagement settings

The <repository> tag defines where the repo will be stored. The <site> defines where the site will be deployed. These will be in my Hg controlled local repo.

  1. Next, I added this to my settings.xml:

Now, when I do a snapshot build, I can execute mvn deploy site-deploy, commit and push the wiki repo, and the snapshot and site are deployed at the same time.