16
16
* limitations under the License.
17
17
*/
18
18
19
+ import org .apache .commons .configuration2 .MapConfiguration ;
19
20
import org .apache .maven .plugin .AbstractMojo ;
20
21
import org .apache .maven .plugin .MojoExecutionException ;
21
22
import org .apache .maven .plugin .MojoFailureException ;
30
31
import org .jbake .app .configuration .JBakeConfigurationFactory ;
31
32
32
33
import java .io .File ;
34
+ import java .util .Map ;
33
35
34
36
/**
35
37
* Runs jbake on a folder
@@ -66,6 +68,12 @@ public class GenerateMojo extends AbstractMojo {
66
68
@ Parameter (property = "jbake.isClearCache" , defaultValue = "false" , required = true )
67
69
protected boolean isClearCache ;
68
70
71
+ /**
72
+ * Properties that are passed to JBake which override the jbake.properties.
73
+ */
74
+ @ Parameter
75
+ protected Map <String , String > properties ;
76
+
69
77
public final void execute () throws MojoExecutionException {
70
78
executeInternal ();
71
79
}
@@ -91,7 +99,10 @@ protected void reRender() throws MojoExecutionException {
91
99
92
100
protected JBakeConfiguration createConfiguration () throws JBakeException {
93
101
DefaultJBakeConfiguration jBakeConfiguration = new JBakeConfigurationFactory ().createDefaultJbakeConfiguration (inputDirectory , outputDirectory , isClearCache );
94
- jBakeConfiguration .addConfiguration (this .project .getProperties ());
102
+ jBakeConfiguration .getCompositeConfiguration ().addConfigurationFirst (new MapConfiguration (project .getProperties ()));
103
+ if (properties != null ) {
104
+ jBakeConfiguration .getCompositeConfiguration ().addConfigurationFirst (new MapConfiguration (properties ));
105
+ }
95
106
return jBakeConfiguration ;
96
107
}
97
108
0 commit comments