diff --git a/pom.xml b/pom.xml
index ec5e15b4..714329ee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -133,7 +133,7 @@
org.jbake
jbake-core
- 2.3.2
+ 2.4.0
org.apache.maven
diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java
index 8436a583..335b7e83 100644
--- a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java
+++ b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java
@@ -18,13 +18,19 @@
import com.orientechnologies.orient.core.Orient;
+import org.apache.commons.configuration.CompositeConfiguration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.MapConfiguration;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
+import org.jbake.app.ConfigUtil;
import org.jbake.app.Oven;
import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
/**
* Runs jbake on a folder
@@ -53,6 +59,15 @@ public class GenerateMojo extends AbstractMojo {
@Parameter(property = "jbake.isClearCache", defaultValue = "false", required = true)
protected boolean isClearCache;
+ /**
+ * Custom configuration properties.
+ * These properties override the properties in jbake.properties
.
+ * In the templates the properties can be accessed using the prefix config.
+ * e.g. config.foo
for the property <foo>bar</foo>
.
+ */
+ @Parameter(required = false)
+ protected Map properties = new HashMap<>();
+
public final void execute() throws MojoExecutionException {
try {
executeInternal();
@@ -79,7 +94,7 @@ protected void reRender() throws MojoExecutionException {
Orient.instance().startup();
// TODO: At some point, reuse Oven
- Oven oven = new Oven(inputDirectory, outputDirectory, isClearCache);
+ Oven oven = new Oven(inputDirectory, outputDirectory, createConfiguration(), isClearCache);
oven.setupPaths();
@@ -90,4 +105,12 @@ protected void reRender() throws MojoExecutionException {
throw new MojoExecutionException("Failure when running: ", e);
}
}
+
+ private CompositeConfiguration createConfiguration() throws ConfigurationException {
+ final CompositeConfiguration config = new CompositeConfiguration();
+ config.addConfiguration(new MapConfiguration(properties));
+ config.addConfiguration(ConfigUtil.load(inputDirectory));
+ return config;
+ }
+
}