Maven projects can use the github pages feature to publish the project site and setup a repository in Github. There is a nice post which describes how to create a new maven project in github. I am not going to repeat that.

After setting up your project, create gh-pages branch for your project.

Drop the following element in the pom.xml file This will instruct maven to deploy the site and the artifacts in the temp folder outside the root folder.


I am using a rake task to automate the release. Create a file named rakefile.rb in the project root folder and drop the following snippet in it. To run this you need the git 1.7.

task :release do
  temp = "../temp"
  puts `git clone -l -s -b gh-pages . #{temp}`
  if system("mvn release:perform")
      puts `cd #{temp} && git add -A && git commit -m "releasing artifacts" && git push origin gh-pages`
      puts `git push origin gh-pages`
      puts " artifact released successfully "
    puts " could not release artifact "
  puts `rm -r #{temp}`

Now you are ready to release the project in Github. The only thing you have to do is instead of calling mvn release:perform run the release task. To perform a release run the following commands.

mvn release:prepare
rake release

I have created a demo project in Github. You can see the project site generated by maven here. The repository can be accessed at the following url Although maven provides lot of features, it sucks when we try to write a custom tasks. It is very easy to convert the above rake task to shell script. I hope this will help someone.