I'm trying to setup and enforce code coverage at the parent module but allow overrides from the child modules. Specifically jacoco-maven-plugin and exclusions for rules coming from child modules. I've been to: http://maven.apache.org/pom.html#advanced_configuration_inheritance and have tried all sorts of the combine options without success.
In the parent I've got a plugin definition like the following:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
...
<configuration>
<rules>
<rule>
<element>CLASS</element>
<limits>
<limit implementation="org.jacoco.report.check.Limit">
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>1.0</minimum>
</limit>
</limits>
</rule>
<rule>
<element>BUNDLE</element>
<limits>
<limit implementation="org.jacoco.report.check.Limit">
<counter>PACKAGE</counter>
<value>COVEREDRATIO</value>
<minimum>1.0</minimum>
</limit>
</limits>
</rule> </rules> </configuration>
In the child modules I'm trying to avoid copy and pasting everywhere but I'm struggling to get the maven plugin configuration to do what I want.
In my child modules I'd like to have something like:
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<rules>
<rule>
<excludes>
<exclude>*Application*</exclude>
<exclude>*Config*</exclude>
</excludes>
</rule>
</rules>
</configuration>
</plugin>
to produce the following effective-pom with the exclusion added to each rule element.
<rules>
<rule>
<element>CLASS</element>
<excludes>
<exclude>*Application*</exclude>
<exclude>*Config*</exclude>
</excludes>
<limits>...</limit>
</limits>
</rule>
<rule>
<element>BUNDLE</element>
<excludes>
<exclude>*Application*</exclude>
<exclude>*Config*</exclude>
</excludes>
<limits>...</limits>
</rule> </rules> </configuration>
I've tried lots of the plugin configuration inheritance attributes but haven't been able to crack it.
combine.self=[merge|override|append]
combine.children=[merge|override|append]
<rules combine.self="merge">
<rule>
<excludes combine.children="append">
<exclude>*Application*</exclude>
<exclude>*Config*</exclude>
</excludes>
</rule>
</rules>
but the resulting effective-pom only contains the first rule definition and that means losing the BUNDLE rule configuration
<rules>
<rule>
<element>CLASS</element>
<excludes>
<exclude>*Application*</exclude>
<exclude>*Config*</exclude>
</excludes>
<limits>...</limit>
</limits>
</rule>
Is it possible to configure maven to ADD/APPEND/OVERRIDE this <excludes/> for each child rule elements?
Thanks for any insights!