Skip to content

Maven repository on Github

I’ve been spending some time updating maven build-scripts, making test-code more portable, and even added a maven repository on my github account.

The problem with “Maven Repositories” it is not always clear what is the minimum needed to distribute code versus what kind of management/proxy server software that someone wants to sell you. The minimum you need is really just a file structure!

Using gh-pages and basics from this blog post, I created a maven-repository (file structure) inside a git-repository (source control) which has both the normal github homepage as well as a custom one (through the gh-pages branch).

The upshot of this is that I can easily provide stable binary releases of libraries.

The basic steps are:

  1. Find a new or existing github repository that does not yet have a “gh-pages” branch
  2. Check it out to a directory, and run a few magic git commands
  3. Create a gh-pages branch, fill it with any web pages you want.
  4. Have your build scripts do a maven “deploy” goal into that directory (via a file:// url)
  5. Commit and push the changes so that they are available through github pages
  6. Add a custom repository (http url) to your projects matching the github pages

Github pages do not show directory listings, so you have to manually build the index.html files yourself if you want your maven repository to be explorable with a web browser. I decided to write my own script to accomplish this which is available here. It uses python to build index.html pages. (I may remove the time-stamps since it adds to the visual overhead of git commits.)

Posted in Programming.

Tagged with , , , .