Skip to content

lefou/mill-jbake

Repository files navigation

JBake plugin for Mill Build Tool

GitHub Actions javadoc de.tobiasroeser.mill.jbake_mill0.10

Mill plugin to create static sites/blogs with JBake.

JBake runs completely on the JVM and supports different template engines and various markup formats, including AsciiDoc(tor).

Quickstart

You need at least Mill in version 0.6.0. Using the latest releases Mill version is recommended.

// build.sc
import mill._
import $ivy.`de.tototec::de.tobiasroeser.mill.jbake::0.3.1` // (1)
import de.tobiasroeser.mill.jbake._

object site extends JBakeModule {

  def jbakeVersion = "2.6.7"

}

<1>: Import the mill-jbake plugin for the correct Mill platform. If you are using an older Mill verion (< 0.9.9), you need to add the platform suffix yourself. E.g. to use it with Mill 0.7, your import looks like:

import $ivy.`de.tototec::de.tobiasroeser.mill.jbake_mill0.7:0.3.1`

Generate the site:

sh> mill site.jbake

Start a local Web-Server on Port 8820 with the generated site:

sh> mill site.jbakeServe

Configuration and Targets

To use the mill-jbake plugin, you have to extends de.tobiasroeser.mill.jbake.JBakeModule.

Mandatory Configuration
  • def jbakeVersion: T[String] - The JBake version to be used. Official release versions down to 2.2.0 are supported out of the box. If you need other version or local installation, you need also to customize jbakeDistributionZip or jbakeDistributionDir.

Optional Configuration
  • def sources: Sources - The directory containing the JBake source files (assets, content, templates). Defaults to src.

  • def jbakeDistributionZip: T[PathRef] - The JBake Binary Distribution ZIP archive. Defaults to downloading the distribution file from Bintray.

  • def jbakeDistributionDir: T[PathRef] - The unpacked JBake Distribution. Defaults to the unpacked content of the jbakeDistributionZip.

  • def jbakeClasspath: T[Seq[PathRef]] - The classpath used to run the JBake site generator.

  • def jbakeProcessMode: ProcessMode - Specify how the JBake tool should be executed.

    Supported value:

    • ClassLoader runs JBake in s isolated classpath in the same JVM.

    • SubProcess spawns a new Java sub-process of each JBake tool invokation.

    Defaults to SubProcess which is slower but is more robust.

Commands
  • def jbake: T[PathRef] - Bake the site with JBake.

  • def jbakeServe(): Command[Unit] - Starts a local Webserver to serve the content created with jbake.

  • def jbakeRun(args: String*): Command[Unit] - Just calls the jbake tool with the given arguments. This might be helpful, if you need to run JBake with different options.

License

mill-jbake is published under the Apache License, Version 2.0.

About

mill

Mill is a Scala-based open source build tool. In my opinion the best build tool for the JVM. It is fast, reliable and easy to understand.

me

My name is Tobias Roeser and I’m a professional software developer and love to write and use open source software. I’m actively developing and maintaining Mill as well as several Mill plugins.

If you like my work, please star it on GitHub. You can also support me via GitHub Sponsors.

Contributing

If you found a bug or have a feature request, please open a new issue on GitHub. I also accept pull requests on GitHub.

Questions

You can also ask questions in the Mill discussions forum or in the Mill Gitter channel.

Changelog

0.3.1 - 2023-11-24

  • Added support for Mill 0.11

  • Build with Mill 0.11

0.3.0 - 2022-05-12

  • Made SubProcess the default process mode

  • Fixed SubProcess worker for Windows

  • Fixed jbakeServe command for JBake newer than 2.6.2

0.2.2 - 2022-05-09

  • Support for newer Mill version up to 0.10.x via cross building

  • Replaced CI system with GitHub Actions

  • Updated JBake download URL, which changed upstream

0.2.1 - 2020-02-28

  • Fixed jbakeInit command

  • Version bump mill API to 0.6.0

0.2.0 - 2019-02-19

  • Use a worker process to run JBake

  • Added new ClassLoader based JBake worker, to speed up repetitive runs

  • Added new `jbakeRun`target to just run the JBake tool with arbitrary arguments

0.1.0 - 2019-02-17

  • Initial public release