jbake icon indicating copy to clipboard operation
jbake copied to clipboard

JBakeConfiguration.addConfiguration should overwrite existing properties

Open kwin opened this issue 4 years ago • 0 comments

Currently the properties added via JBakeConfiguration.addConfiguration are not overwriting same name configuration keys already set in the config. This is due to the fact that the configuration is merged with CompositeConfiguration.addConfiguration(...) in https://github.com/jbake-org/jbake/blob/38946aab9507da49cc58eff48e893de891ff509a/jbake-core/src/main/java/org/jbake/app/configuration/DefaultJBakeConfiguration.java#L684 while it should use CompositeConfiguration.addConfigurationFirst().

This is important for the jbake-maven-plugin which calls https://github.com/jbake-org/jbake-maven-plugin/blob/e550c42b1cea4b360c5bc81183ecc87122a4291e/src/main/java/org/jbake/maven/GenerateMojo.java#L94. That way it would be possible to overwrite existing values in the jbake.properties with e.g. Maven profile specific values.

This is especially important as the existing configuration contains all keys from both local and default jbake.properties already (https://github.com/jbake-org/jbake/blob/38946aab9507da49cc58eff48e893de891ff509a/jbake-core/src/main/java/org/jbake/app/configuration/ConfigUtil.java#L34).

kwin avatar Jul 26 '21 07:07 kwin