'Apache Camel - Camel Report Plugin is not generating the JaCoCo xml

I am using Apache Camel 3.14.0 with SpringBoot and trying to generate code coverage report with JaCoCo xml so that SonarQube can use it to show code coverage. I followed all the steps mentioned in https://camel.apache.org/manual/camel-report-maven-plugin.html#_camelroute_coverage but still the jacoco xml file is not getting generated rather it shows the coverage in console.

I have below dependency in my pom.xml:

<dependency>
   <groupId>org.apache.camel</groupId>
   <artifactId>camel-management</artifactId>
   <version>${camel.springboot.version}</version>
   <scope>test</scope>
</dependency>

My test file has below annotations:

@CamelSpringBootTest
@EnableAutoConfiguration
@SpringBootTest(classes = MyApplication.class)
@MockEndpoints(value = "direct:first-route")
@EnableRouteCoverage

I executed mvn test command and all the tests are passed and generated individual test xml file inside target/camel-route-coverage directory. After this, I am executing mvn camel-report:route-coverage -DgenerateJacocoXmlReport=true command which shows code/route coverage on console but doesn't generate target/site/jacoco/xmlJacoco.xml file.

Due to this, I am unable to view code coverage in SonarQube.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source