Nav
You are viewing an older version of this topic. To go to a different version, use the version menu at the upper-right. +

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:

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.

+