Using JBake + Maven to post your blog on GitHub Pages

06 April 2015

This post explains the steps to publish your blog using JBake and deploy it to GitHub Pages.

Install JBake
  • Download it from

  • Unzip it somewhere:

    $ unzip ~/Downloads/
    $ cd ~/jbake-2.3.2/
    $ export PATH=~/jbake-2.3.2/bin:$PATH
Install Java, Maven and Git in Fedora 21/22:
$ sudo yum install -y java-1.8.0-openjdk-devel maven git

Edit ~/.m2/settings.xml to add a <server>:

      <id>github</id> (1)
      <password>shequeethaich9eegaht2tahch4ooviephaqu0di</password> (2)
  1. The server name

  2. The OAUTH Token from

Paste the OAUTH you get from Applications page.

Create a project in GitHub, call it "" and clone it:

$ mkdir ~/src
$ cd ~/src
$ git clone

Create a test page just to see if it works:

$ cd ~/src/
$ echo "Hello" > index.html
$ git add index.html
$ git commit -m "Test page"
$ git push

Check to see if it says "Hello".

Create a new branch called "jbake" to add the blog source code:

$ git checkout --orphan -b jbake
$ mkdir -p src/main/jbake
$ cd src/main/jbake
$ jbake -i
  JBake v2.3.2 (2014-09-21 01:47:44AM) []
  Base folder structure successfully created.
$ cd ~/src/
In your DNS server add a CNAME to and pointing to
Add a CNAME in JBake "assets" diretory
$ echo > ~/src/
Add a .gitignore to the "assets" directory:
$ echo target > ~/src/

Edit ~/src/ to your taste

Create a pom.xml file to bake the site:

<project xmlns=""
  <name> website</name>
  <description>The website source code</description>
          <message>Site update</message>

Bake the site:

$ mvn package

If your like it publish it using the "site" Maven goal, that deploys the baked HTML site to the "master" branch, that you can access using

$ mvn site

To have Travis build deploy the website automatically, you have to encrypt your GitHub Token. Create a .travis.yml file:

language: java
  - openjdk7
  - mvn --settings src/travis/settings.xml clean package site
  - jbake

Then, add the encrypted GitHub Token to the file:

$ sudo yum install -y ruby rubygems
$ travis encrypt GH_TOKEN=<token> --add

You also need a custom Maven settings.xml file:

$ mkdir -p src/travis
$ vi src/travis/settings.xml

Push the changes:

$ git commit -a -m "Add Travis support"
$ git push

Travis will deploy your site on every commit on the "jbake" branch.

Older posts are available in the archive.