diff --git a/pom.xml b/pom.xml index 551cd0a9..aa504b11 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ 3.1.1 - + jbake-maven-plugin jbake-maven-plugin is a Maven plugin allowing you to integrate JBake into your projects build http://jbake.org @@ -111,7 +111,7 @@ org.jbake jbake-core - 2.6.2 + 2.6.3 org.apache.maven @@ -178,7 +178,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.4 + 3.6.0 jbake @@ -252,4 +252,4 @@ - \ No newline at end of file + diff --git a/src/main/java/org/jbake/maven/GenerateMojo.java b/src/main/java/org/jbake/maven/GenerateMojo.java index 86cdbfbd..c9ee76d5 100644 --- a/src/main/java/org/jbake/maven/GenerateMojo.java +++ b/src/main/java/org/jbake/maven/GenerateMojo.java @@ -18,7 +18,6 @@ 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; @@ -29,9 +28,9 @@ import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.project.MavenProject; import org.jbake.app.Oven; +import org.jbake.app.configuration.ConfigUtil; import org.jbake.app.configuration.DefaultJBakeConfiguration; import org.jbake.app.configuration.JBakeConfiguration; -import org.jbake.app.configuration.JBakeConfigurationFactory; import java.io.File; @@ -98,8 +97,6 @@ protected void reRender() throws MojoExecutionException, MojoFailureException { // TODO: At some point, reuse Oven Oven oven = new Oven(createConfiguration()); - oven.setupPaths(); - oven.bake(); if (failOnError && !oven.getErrors().isEmpty()) { throw new MojoFailureException("Baked with " + oven.getErrors().size() + " errors. Check output above for details!"); @@ -112,18 +109,11 @@ protected void reRender() throws MojoExecutionException, MojoFailureException { } 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(baseConfiguration.getCompositeConfiguration()); - - config.addConfiguration(new MapConfiguration(this.project.getProperties())); - - return jbakeConfigurationFactory.createDefaultJbakeConfiguration(inputDirectory, outputDirectory, config, isClearCache); + DefaultJBakeConfiguration jBakeConfiguration = (DefaultJBakeConfiguration) new ConfigUtil().loadConfig(inputDirectory); + jBakeConfiguration.getCompositeConfiguration().addConfiguration(new MapConfiguration(this.project.getProperties())); + jBakeConfiguration.setDestinationFolder(outputDirectory); + jBakeConfiguration.setClearCache(isClearCache); + return jBakeConfiguration; } }