Trouble generating JaCoCo XML format

I have similar issue. I am using jacoco version 0.8.6. On executing through mvn build, i get the following error “java.lang.IllegalStateException: Failed to parse JaCoCo XML report:”. The jacoco.xml file is getting generated, but it is in the same format as like jacoco.exec file. And hence the error says unable to parse the file.
Looks like i am missing something to generate in the proper xml format. I have set the sonar.coverage.jacoco.xmlReportPaths as well. So could you please help me with property that i need to set for generating the report in xml format. I am using maven pom.xml file to build my application.

Here is my snapshot of error trace
[ERROR] Coverage report ‘C:\Users…\target\coverage-reports\jacoco.xml’ could not be read/imported. Error: {}
java.lang.IllegalStateException: Failed to parse JaCoCo XML report: C:\Users…\target\coverage-reports\jacoco.xml
at org.sonar.plugins.jacoco.XmlReportParser.parse(XmlReportParser.java:96)
at org.sonar.plugins.jacoco.JacocoSensor.importReport(JacocoSensor.java:73)
at org.sonar.plugins.jacoco.JacocoSensor.importReports(JacocoSensor.java:64)

Hi @Obuli_Sankar, welcome to the SonarSource Community!

We have a guide dedicated to this topic. Please have a look there and follow the instructions carefully. It looks like you may not have adjusted your pom.xml properly to stop building the exec format and instead build the XML.

We are stuck with the same error. I followed the steps mentioned on " guide dedicated to this topic" page. However the file generated is still not the correct XML format. We printed the jacoco.xml file in jenkins and found something as below (pasting only few lines)

��aca6191af5ae0-1a24a201}-�Sy}-ƌ|pW�\����;org/springframework/context/annotation/BeanAnnotationHelper�w~�j�zI�ZMorg/springframework/boot/autoconfigure/condition/FilteringSpringBootCondition!������e֢+org/springframework/cglib/core/ReflectUtils�|O���I�>������e��o�1org/aspectj/weaver/patterns/AnnotationTypePattern.8l�+��S4com/fasterxml/jackson/annotation/JsonProperty$Accessa}o}ۿ"?�org/junit/runner/Description=I��|^�’)FHnet/bytebuddy/implementation/bytecode/member/MethodInvocation$Invocation-o��CD
a��[�]org/springframework/context/annotation/ConfigurationClassParser$DeferredImportSelectorHandler�}"���W���Jorg/springframework/boot/context/properties/PropertyMapper$CachingSupplier�1���,i�Rorg/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerMapping������������’IH\a>\�����Wnet/bytebuddy/description/type/TypeDescription$Generic$AnnotationReader$ForTypeArgument�7���A�3org/springframework/cglib/core/DebuggingClassWriter� ��5�9�u!org/aspectj/weaver/RuntimeVersion�W���BH:org/springframework/beans/propertyeditors/PropertiesEditorV��\�Z<Morg/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController)����D�=org/springframework/format/datetime/standard/InstantFormatter �M���*v�0org/apache/logging/log4j/core/lookup/UpperLookup}�����:org/apache/logging/log4j/core/config/AbstractConfiguration����8w�’!���<�q��}^�� >3�>0w�����}���rx��j~S

sW/com/fasterxml/jackson/databind/cfg/MapperConfig>�wf�0Hr�K

is your issue resolved? I am also facing the same. jacoco.xml file is generated but it is the binary format.

Hi , I am exactly facing the same issue
Is your issue got resolved? I have followed the steps mentioned in the guide but still it is not parsing properly.