Problem building JBake project with Gradle 2.4

I’m having an odd problem where a project using the JBake plugin builds correctly with Gradle < 2.4 but incorrectly with 2.4. I suspect it may be to do with the additional classpath components loaded in the buildscript section but I’m not sure.

GitHub project

This is just using the standard JBake Freemarker template example code with a build.gradle file.

Thanks for the example project.

I don’t know enough about the plugin, but there seems to be some static state being kept around between runs if you’re using the daemon. If you run with --no-daemon it works. We turned on class reuse in 2.4 with this warning, which seems to fit what you’re seeing.

When running with --debug, you can see output from the jbake Crawler says that the missing files are “same”, which is why it’s not copying them. Someone a little more familiar with the plugin might be able to suggest a workaround (e.g., clearing something in an buildFinished {} hook).

I see @CedricChampeau has had his fingers in this before :smile:


Indeed I wrote the plugin. It doesn’t keep any state in static fields itself, but it is possiblethat JBake does. In particular, the Asciidoctor instance takes several seconds to instantiate, so it is usually kept in a static field. In fact JBake keeps all engines in a static field: see

That said, I am not sure how relevant it is. This is not “state” information, but really something reentrant. Engines can be safely reused among different threads, so there shouldn’t be any state to clear…


it’s a problem of the cached document datastore.
try to set jbake.clearCache = true.

Thanks, that does fix it