A Gradle plugin for JBake
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


JBake plugin for Gradle

Build Status Coverage Status Apache License 2 download

This plugin allows rendering a site using JBake directly from Gradle.


A few of the sites that use the plugin and serve as a good example are:


This is work in progress

plugins {
    id 'org.jbake.site' version '1.2.0'

This will add a bake task to your build, which will search for a standard JBake source tree in src/jbake and generate content into $buildDir/jbake (typically build/jbake).

versions prior to 1.0.0 had a task named jbake. This task has been renamed to bake since 1.0.0.


Plugin configuration

The default input and output directories can be changed using the jbake configuration block:

jbake {
    srcDirName  = 'jbake-sources'
    destDirName = 'output'

The generated output can then be found at $buildDir/output.

The Version could be changed too:

jbake {
    version  = '2.3.0'

The default is 2.6.1.

Render Engine configuration

Jbake uses several engines. The library versions could be changed too:

jbake {
    pegdownVersion = '1.6.0'
    flexmarkVersion = '0.32.20'
    freemarkerVersion = '2.3.28'
    groovyTemplatesVersion = '2.4.15'
    jade4jVersion = '1.2.7'
    thymeleafVersion = '3.0.2.RELEASE'
    asciidoctorJavaIntegrationVersion = '0.1.4'
    asciidoctorjVersion = '1.5.5'

Notice the asciidoctorJavaIntegrationVersion and asciidoctorjVersion. Since Version 2.3.1 jbake has changed to the asciidoctorj library.

This plugin handles this change internally. If you use a Version > 2.3.0 of jbake, the dependency switch to the new one.

Since Version 2.6.0 jbake uses flexmark as replacement for pegdown.

JBake configuration

There are several options to configure JBake. One is to have the regular jbake.properties file into the source directory. The other is to use the plugin configuration block:

jbake {
   configuration['template.post.file'] = 'mypost.ftl'

Repositories configuration

The plugin will automatically include jcenter() as a repository in order to resolve JBake and template engine dependencies. You may deactivate this feature by setting includeDefaultRepositories to false, like so

jbake {
   includeDefaultRepositories = false
You must still define at least one repository from where all JBake and template engine dependencies should be resolved. Failure to do so will result in a build error.

JDK 9 Compatibility Notes

JBake uses a jdk7 compatible version of orientdb. There are issues with jdk9 builds which are unable to determine the MaxDirectMemorySize.

If you are running into this issue you can add the -XX:MaxDirectMemorySize JVM Option to your gradle.properties file.