Skip to content

Commit

Permalink
Adjustments to make it compatible with JBake 2.6.2
Browse files Browse the repository at this point in the history
This closes jbake-org#16
  • Loading branch information
kwin committed Oct 10, 2018
1 parent 8ecf3d3 commit a998ccf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<dependency>
<groupId>org.jbake</groupId>
<artifactId>jbake-core</artifactId>
<version>2.6.1</version>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
Expand Down
18 changes: 12 additions & 6 deletions src/main/java/org/jbake/maven/GenerateMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();

Expand All @@ -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);
}

}

0 comments on commit a998ccf

Please sign in to comment.