This blog is about Java (advanced Java topics like Reflection, Byte Code transformation, Code Generation), Maven, Web technologies, Raspberry Pi and IT in general.

Montag, 16. Februar 2015

Publish Maven Site Documentation automatically to the GitHub Pages

Maven site is a great tool as well as GitHub. The coolest thing about those tools is that they play together very well. Only a little Maven configuration is needed. But let me explain shortly what both tools do.

Maven Site: generates automatically a nice documentation website for your Maven project. Many Apache projects uses this generated site as their main website. So probably you have already seen such generated websites. An nice example is the my (parent) POM project or the maven-site-plugin. Mainly the documentation consists of three parts:
  • Project information like dependencies, license, source repository and so on. 
  • Project reports like unit tests reports, static code analysis reports, JavaDocs and so on. 
  • The documentation written by the developers. With an additional Maven Plugin it's possible to write the documentation with Markdown.
GitHub Pages: GitHub doesn't only provide a GIT repository but also can be used as webhost for static website. Which is ideal for a project website. The GitHub Pages concept is very cool. It's just a branch, called gh-pages, in you project repository. All the files that are pushed into this branch will be served from GitHub`s webserver. An nice example is the documentation for my (parent) POM project.
Before you start with the Maven configuration you should read Creating Project Pages manually for a better understanding.

Before we can start with the GitHub Pages integration into Maven we firstly need to correctly build the website. For multi module projects it's necessary to deploy (locally is sufficient) the website first. Otherwise the references between modules won't work. To do so you just need to configure the distribution management like this:


How to fully configure the generation of the Maven Site is too much for this blog post. Look at the POM for some good basic configuration or just us it as parent POM for your project. The minimum of configuration is:

                <!-- used for multiproject builds -->
                <!-- To use the Markdown format -->


To build the Maven Site just use: mvn clean site site:deploy
The integration into the GitHub pages is very easy and looks like this:

                <checkinComment>publishing site documentation</checkinComment>

Additional you need to configure your username and password in the .m2/settings.xml. It should look like this:

<settings xmlns=""

If everything is done just type: 

mvn clean site site:deploy scm-publish:publish-scm -Dscmpublish.dryRun=true

The scmpublish.dryRun flag prevents the plugin to commit anything and just outputs what changes it would commit. Check it and if everything works than rerun the command without this flag: 

mvn clean site site:deploy scm-publish:publish-scm

That's it! It's Very simple :)

2 Kommentare:

  1. roundhill sports betting 우리카지노 쿠폰 우리카지노 쿠폰 카지노 카지노 344WILLIAM HILL TOTO NATIONAL RAID | ThToBet

  2. An industrial robotic guides the hemming roller and varieties the flange. With die hemming, the flange is folded over the entire length with a hemming software. Increasing choice for aluminum as fuselage steel owing to its 3 times higher lifespan will bolster the growth of the sheet steel industry. Aluminum is most popular over conventional alloys owing to its non-corrosive properties, high tensile strength and it being 50% lighter than steel. The rising demand for lightweight sheet metals in the development of automotive chassis and our bodies is ready to drive its market over the forecast period. Depending on the alloying metals such Toilet Paper Bulk as chromium, nickel, manganese, and silicon, stainless is often far more costly than aluminum or carbon steel.