Setting up a Maven repository on Kenai

Over at Project Kenai one minor issue is that it doesn’t currently support maven repositories. Although it is on their list of features to implement it’s probably not going to be available for a while.

So what if your project needs a public maven repository on Kenai?

Well the trick is to:

    add an additional subversion repository to your project which will host your repository.
  • Then on your local machine check out that new repository and tell maven to deploy to that directory instead of a remote repository.
  • Manually add any new files that have been added by maven
  • commit the changes

To use the repository simply use the subversion repositories public url as a repository definition.

Here’s the gory details on what to add to your pom’s. For all of these examples you will need to substitute reteptools~maven with the name of your subversion repository. I’m using a releases subdirectory within the repo but that is optional.

In your pom.xml you need to add a distributionManagement element pointing to your local checked out copy of the repository. If your project has child modules in it you can put this into the parent pom as it will be inherited.

    <distributionManagement>
        <repository>
            <uniqueVersion>false</uniqueVersion>
            <id>retep.releases</id>
            <name>Retep.org repository</name>
            <url>file:/Users/peter/repository/reteptools~maven/releases</url>
        </repository>
    </distributionManagement>

Next if your pom’s need to refer to your public repository you need to reference it with a repository and/or pluginRepository definition. In this case you need to use http://kenai.com/svn/ and your project~repository name as the url. Here’s what you would use to access my repository on kenai:

        <repository>
            <id>retep.releases</id>
            <name>retep.org Maven 2 Repository</name>
            <url>http://kenai.com/svn/reteptools~maven/releases/</url>
        </repository>

        <pluginRepository>
            <id>retep.releases</id>
            <name>retep.org Maven 2 Repository</name>
            <url>http://kenai.com/svn/reteptools~maven/releases/</url>
        </pluginRepository>

Now you have done this, you can build as normal. However when it comes to deploying you first run:

 mvn deploy

to deploy to your repository. Because of the distributionManagement element it will deploy to your checked out copy.

Next change directory into your repository and add any new files:

 cd /Users/peter/repository/reteptools~maven/releases
 svn status
 svn add ...add any files shown as unknown...
 svn commit -m “brief commit message”

That’s all there is to it.

At some point I’m going to see if it’s possible to automate the commit process into subversion, but for now this works.

Update:

2009-04-24 12:14: ODFToolkit (which uses a subset of kenai and was partly why I started looking into this issue) doesn’t have subversion available just Mercurial so we had the question – would this work with mercurial.

Well it looks like it is possible, just base your repository path with the template: http://kenai.com/hg/projectName~repositoryName/raw-file/tip/

This appears to serve the files cleanly.

Moving to Kenai

Well having tried various PHP content management systems on retep.org I’ve just about had enough. I was trying Liferay as well (and that was looking good), but in the end I was spending way too much time on getting things working rather than getting down to coding I’ve decided to move back to using one of the “forges” out there.

The other reason was cost – running a dedicated server was just costing too much each month.

Anyhow I’ve going to move everything over to Project Kenai provided by Sun. It’s supports Mercurial, Forums a Wiki and more importantly Jira.

RetepTools is now over and it’s project page is now http://kenai.com/projects/reteptools, and Jira is now up to date with what was in Mantis.

I’ll be moving the MicroKernel over later tonight and I’ll be deciding on how to migrate the other projects over with the intention of shutting down the old site at the weekend. The one thing I have left to sort is getting a working Maven repository working. I’m not the only one using that site and want Maven so hopefully it wont be long (the main requestors are the ODFToolkit team).

Anyhow one this process is complete then this blog will be moving to become the main retep.org homepage.