My project inherits from another project which sets these properties:
<sonar.jacoco.itReportPath>${jacoco.outputDir}/${jacoco.out.it.file}</sonar.jacoco.itReportPath>
<sonar.jacoco.reportPath>${jacoco.outputDir}/${jacoco.out.ut.file}</sonar.jacoco.reportPath>
and plugin section defined like
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>prepare-ut-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<phase>process-test-classes</phase>
<configuration>
<destFile>${sonar.jacoco.reportPath}</destFile>
<propertyName>jacoco.agent.ut.arg</propertyName>
<append>true</append>
</configuration>
</execution>
due to the deprecated property in parent pom.xml, I am unable to generate the sonar coverage report.
So I try to override the settings in child pom.xml, by writing the below settings:
<jacoco.out.ut.file>jacoco.xml</jacoco.out.ut.file>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sonar.coverage.jacoco.xmlReportPaths>${jacoco.outputDir}/${jacoco.out.ut.file}</sonar.coverage.jacoco.xmlReportPaths>
and in the build section:
<profiles>
<profile>
<id>coverage</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<phase>process-test-classes</phase>
<configuration>
<destFile>${sonar.coverage.jacoco.xmlReportPaths}</destFile>
<append>true</append>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
I am getting jacoco.xml file generated but in the binary format, not xml, which fails during reading.