Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

JBake plugin for Gradle

Build Status Coverage Status Apache License 2 Gradle Plugin Portal, link=

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


  • Java 8

  • Gradle 6+


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


This is work in progress

plugins {
    id '' version '5.5.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.


You can initialise the project structure by running the following command:

gradle bakeInit

The default template is set to groovy. You may change this setting by updating the template property of the jbake configuration. Accepted values are freemarker, groovy, groovy-mte, thymeleaf`, jade.

Alternatively you may define a value for templateUrl that points to a custom template, for example

bakeInit {
    templateUrl = ''


You can preview your content by running the following command:

gradle bake bakePreview

This will start up a jetty container and serve your baked site on http://localhost:8080 by default. You can change the port by adding this to your build file.

bakePreview {
    port = '8090'

The bakePreview task is configured to server the output of the bake task. Should you need to render a different set of files then specify a value for the input property, like so

bakePreview {
    input = project.file('path/to/content')


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.6.5'

The default is 2.6.7.

Render Engine configuration

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

jbake {
    pegdownVersion = '1.6.0'
    flexmarkVersion = '0.62.2' // since jbake 2.6.0
    freemarkerVersion = '2.3.31'
    groovyTemplatesVersion = '3.0.7'
    jade4jVersion = '1.2.7'
    thymeleafVersion = '3.0.12.RELEASE'
    pebbleVersion = '3.1.5' // since jbake 2.6.5
    asciidoctorJavaIntegrationVersion = '0.1.4' //pre jbake 2.3.1
    asciidoctorjVersion = '2.4.3' //since jbake 2.3.1
    jettyVersion = '9.4.36.v20210114'

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 file into the source directory. The other is to use the plugin configuration block:

jbake {
   configuration[''] = 'mypost.ftl'