SBuild JBake Plugin can be downloaded from Maven Central.
To include it in you SBuild buildfile use the @classpath
annotation:
@classpath("mvn:org.sbuild:org.sbuild.plugins.jbake:0.1.2")
You need a recent version of SBuild.
git clone https://github.com/SBuild-org/jbake.git cd sbuild-sbuild-plugin/org.sbuild.plugins.jbake sbuild all
You will find the built jar in the directory org.sbuild.plugins.jbake/target
.
All configurable properties are documented via ScalaDoc. See file JBake.scala
.
In it’s default configuration, this plugin will provide the following targets:
-
jbake - bake the site
-
serve-jbake - start a local web server on port 8820. This target will depend on the jbake target
-
init-jbake (optional) - create an initial JBake source directory layout with style, layout, and example files
If you create a named plugin instance, the generated targets are:
-
jbake-${name} - bake the site
-
serve-jbake-${name} - start a local web server on port 8820. This target will depend on the jbake-${name} target
-
init-jbake-${name} (optional) - create an initial JBake source directory layout with style, layout, and example files
Minimal example, which will generate a jbake site from src/jbake
to target/jbake
.
import de.tototec.sbuild._
@version("0.7.2")
@classpath("mvn:org.sbuild:org.sbuild.plugins.jbake:0.1.2")
class SBuild(implicit _project: Project) {
Plugin[org.sbuild.plugins.jbake.JBake]
}
Another example, using JBake 2.2.1 to generate a site from src/website
to target
.
import de.tototec.sbuild._
@version("0.7.2")
@classpath("mvn:org.sbuild:org.sbuild.plugins.jbake:0.1.2")
class SBuild(implicit _project: Project) {
import org.sbuild.plugins.jbake._
Plugin[JBake] configure { _.copy(
jbakeVersion = JBakeVersion.Packaged("2.2.1"),
sourceDir = Path("src/website"),
targetDir = Path("target")
)}
}
-
Evaluate return code of jbake process and fail the task accordingly.
-
Added optional "init-jbake" target to create the initial project layout.
-
Fixed JBake classpath resolution from ZIP files (wrong regex).
-
Added JBakeVersion.Classpath to allow customized JBake runtimes.
-
Added convenient contructor method for
JBakeVersion.Packaged
supporting the typical use case: downloading and using JBake from http://jbake.org.