YAML Merge Maven Plugin

This Plugin is intended for systems/plugins that cannot handle YAML merge keys itself. The plugin can parse and process yaml files and store them in an output file with the merge keys resolve.

Usage

pom.xml

<plugin>
    <groupId>io.github.menostos</groupId>
    <artifactId>yaml-merge-maven-plugin</artifactId>
    <version>1.1.1-SNAPSHOT</version>
    <executions>
        <execution>
            <goals>
                <goal>resolve</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <!-- the input file which will be processed -->
        <input>${project.basedir}/src/main/resources/input.yaml</input>
        <!-- an output file or directory which is used for output -->
        <output>${project.build.directory}/output.yaml</output>
        <!-- any object key which starts with this prefix will not be present in the final yaml (defaults to ".") -->
        <keyIgnorePrefix>.</keyIgnorePrefix>
    </configuration>
</plugin>

input.yaml

.errors: &errorResponses
  401: unauthorized
  403: forbidden
  404: notfound
  500: error
apis:
  firstApi:
    200: ok
    <<: *errorResponses
  secondApi:
    200: somewhat ok
    <<: *errorResponses

output.yaml

apis:
  firstApi:
    200: ok
    401: unauthorized
    403: forbidden
    404: notfound
    500: error
  secondApi:
    200: somewhat ok
    401: unauthorized
    403: forbidden
    404: notfound
    500: error

Maven Documentation

Read more about the Maven Configuration here