diff --git a/jbake-maven-plugin/src/main/java/org/jbake/maven/GenerateMojo.java b/jbake-maven-plugin/src/main/java/org/jbake/maven/GenerateMojo.java index fcb70cc9..90a6c204 100644 --- a/jbake-maven-plugin/src/main/java/org/jbake/maven/GenerateMojo.java +++ b/jbake-maven-plugin/src/main/java/org/jbake/maven/GenerateMojo.java @@ -16,6 +16,7 @@ * limitations under the License. */ +import org.apache.commons.configuration2.MapConfiguration; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; @@ -30,6 +31,7 @@ import org.jbake.app.configuration.JBakeConfigurationFactory; import java.io.File; +import java.util.Map; /** * Runs jbake on a folder @@ -66,6 +68,12 @@ public class GenerateMojo extends AbstractMojo { @Parameter(property = "jbake.isClearCache", defaultValue = "false", required = true) protected boolean isClearCache; + /** + * Properties that are passed to JBake which override the jbake.properties. + */ + @Parameter + protected Map properties; + public final void execute() throws MojoExecutionException { executeInternal(); } @@ -91,7 +99,10 @@ protected void reRender() throws MojoExecutionException { protected JBakeConfiguration createConfiguration() throws JBakeException { DefaultJBakeConfiguration jBakeConfiguration = new JBakeConfigurationFactory().createDefaultJbakeConfiguration(inputDirectory, outputDirectory, isClearCache); - jBakeConfiguration.addConfiguration(this.project.getProperties()); + jBakeConfiguration.getCompositeConfiguration().addConfigurationFirst(new MapConfiguration(project.getProperties())); + if (properties != null) { + jBakeConfiguration.getCompositeConfiguration().addConfigurationFirst(new MapConfiguration(properties)); + } return jBakeConfiguration; }