Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+
Nav

To Override a Parent’s Plugin

When inheriting the plugin from a parent POM file, you can also choose to override the parent’s configuration, but keep in mind that overriding completely suppresses the original configuration, requiring you to declare all necessary configurations again:

Coverage configuration in parent POM file

         
      
1
2
3
4
5
6
7
8
9
10
11
<coverage>
        <runCoverage>true</runCoverage>
        <failBuild>false</failBuild>
        <requiredApplicationCoverage>0</requiredApplicationCoverage>
        <requiredResourceCoverage>0</requiredResourceCoverage>
        <requiredFlowCoverage>0</requiredFlowCoverage>
        <formats>
                <format>console</format>
                <format>html</format>
        </formats>
</coverage>
POM child file overriding coverage report’s format

         
      
1
2
3
4
5
6
7
8
9
10
11
12
<plugin>
        <groupId>com.mulesoft.munit.tools</groupId>
        <artifactId>munit-maven-plugin</artifactId>
        <configuration>
                <coverage>
                        <runCoverage>true</runCoverage>
                        <formats>
                                <format>html</format>
                        </formats>
                </coverage>
        </configuration>
</plugin>

In this example, this child project is overriding the console coverage report, replacing it only by the HTML one, but since the values from the other elements in the parent (<failBuild>, <requiredApplicationCoverage>, <requiredResourceCoverage>, <requiredFlowCoverage>) are not being referenced, this child file won’t inherit them and the default values will apply.

In this topic: