When working with JaCoCo in a maven multi-module project it is necessary to use the report-aggregate goal to create an aggregated test coverage report.
The format of the jacoco.xml file in this case is a little different to the version produced when using the report goal as JaCoCo outputs an additional <group name="api-common"> element as the parent of the <package> element which the coverage formatter is expecting. The purpose of the<group>element is to state which module contains the code described by the child elements of the group.
It would be nice (in the short term) if the codeclimate reporter could just ignore <group> elements as allowing multiple items in the JACOCO_SOURCE_PATH env-var means this would work quite nicely. In the longer term the reporter could potentially use the content of the <group> element to auto-discover the correct source paths to use.
When working with JaCoCo in a maven multi-module project it is necessary to use the
report-aggregate
goal to create an aggregated test coverage report.The format of the jacoco.xml file in this case is a little different to the version produced when using the
report
goal as JaCoCo outputs an additional<group name="api-common">
element as the parent of the<package>
element which the coverage formatter is expecting. The purpose of the<group>
element is to state which module contains the code described by the child elements of the group.A sample project using the
report-aggregate
goal can be found here: https://github.com/DEFRA/data-returns-api-platformAs a workaround I was able to strip
<group>
elements from the xml file before running cc-reporter as follows:It would be nice (in the short term) if the codeclimate reporter could just ignore
<group>
elements as allowing multiple items in theJACOCO_SOURCE_PATH
env-var means this would work quite nicely. In the longer term the reporter could potentially use the content of the<group>
element to auto-discover the correct source paths to use.