## Tuesday, February 23, 2010

### Google Code as Maven Repository

In this post I will explain how to set up a Google code project as a maven repository.

I like Maven. The fact that I can checkout some code and let Maven figure out all the dependencies is wonderful. I know that there are developers out there who will criticize Maven. But in my opinion, a lot of the critique is not really justified.

I also like Google code project hosting. It is very easy to start a project on Google code and have a mature environment for software development.

When I was looking around for a way to publicize my own artefacts I came across the idea of using project hosting on Google code as a maven repository. Because It took me a while to get everything up and running, I will outline the steps I had to take.

As a precondition, I assume a you have a Google code project where you can submit to and a working maven project.

1. Add the Java.net maven repository.

We will be using a plugin which is found on the java.net maven repository.


maven2-repository.dev.java.net
Java.net Repository for Maven



We are going to use the wagon-svn plugin which will do all the heavy lifting for us. Make sure to use the latest version.


org.jvnet.wagon-svn
wagon-svn
1.9



3. Come up with a naming scheme.

We are going to create repositories in the svn tree. I propose the following convention. Create a maven directory at the top of the svn tree. This directory will contain a repo directory and a snapshot-repo.

This can be configured in the following way.


minimal-examples-repository
Maven Repository for minimal-examples

minimal-examples-snapshot-repository
Maven Repository for minimal-examples (snapshot)
false



Now we are all set to start deploying! By running the command maven deploy, the svn-wagon plugin will deploy the artifacts to the repository. The first time you will have to accept the certificate that the Google code project return.
Furthermore, you will have to authenticate yourself with your username and password which are known to the Google code project. You can take up this information in your ~/.m2/settings.xml, so you do not have to enter this information all the time.



minimal-examples-repository

minimal-examples-snapshot-repository



This wraps up the set up for using a Google code project as a Maven repository.