From a998ccf97cf35854621ea874f25a0009553125be Mon Sep 17 00:00:00 2001 From: Konrad Windszus Date: Wed, 10 Oct 2018 13:12:29 +0200 Subject: [PATCH] Adjustments to make it compatible with JBake 2.6.2 This closes #16 --- pom.xml | 2 +- .../java/org/jbake/maven/GenerateMojo.java | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 5ad9207f..551cd0a9 100644 --- a/pom.xml +++ b/pom.xml @@ -111,7 +111,7 @@ org.jbake jbake-core - 2.6.1 + 2.6.2 org.apache.maven diff --git a/src/main/java/org/jbake/maven/GenerateMojo.java b/src/main/java/org/jbake/maven/GenerateMojo.java index 957a0f44..473aa7f4 100644 --- a/src/main/java/org/jbake/maven/GenerateMojo.java +++ b/src/main/java/org/jbake/maven/GenerateMojo.java @@ -27,9 +27,10 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.project.MavenProject; -import org.jbake.app.ConfigUtil; -import org.jbake.app.JBakeException; import org.jbake.app.Oven; +import org.jbake.app.configuration.DefaultJBakeConfiguration; +import org.jbake.app.configuration.JBakeConfiguration; +import org.jbake.app.configuration.JBakeConfigurationFactory; import java.io.File; @@ -88,7 +89,7 @@ protected void reRender() throws MojoExecutionException { Orient.instance().startup(); // TODO: At some point, reuse Oven - Oven oven = new Oven(inputDirectory, outputDirectory, createConfiguration(), isClearCache); + Oven oven = new Oven(createConfiguration()); oven.setupPaths(); @@ -100,14 +101,19 @@ protected void reRender() throws MojoExecutionException { } } - protected CompositeConfiguration createConfiguration() throws ConfigurationException { + protected JBakeConfiguration createConfiguration() throws ConfigurationException { + JBakeConfigurationFactory jbakeConfigurationFactory = new JBakeConfigurationFactory(); + + // load base config (cast to DefaultJBakeConfig) + DefaultJBakeConfiguration baseConfiguration = (DefaultJBakeConfiguration)jbakeConfigurationFactory.getConfigUtil().loadConfig(inputDirectory); + final CompositeConfiguration config = new CompositeConfiguration(); - config.addConfiguration(ConfigUtil.load(inputDirectory)); + config.addConfiguration(baseConfiguration.getCompositeConfiguration()); config.addConfiguration(new MapConfiguration(this.project.getProperties())); - return config; + return jbakeConfigurationFactory.createDefaultJbakeConfiguration(inputDirectory, outputDirectory, config, isClearCache); } }