sfeir-open-source / sonar-clover

It provides the ability to feed SonarQube with code coverage data coming from Atlassian Clover
Apache License 2.0
15 stars 25 forks source link

Error during parsing of the generic coverage report #40

Closed mhagnumdw closed 4 years ago

mhagnumdw commented 4 years ago

Describe the bug Error during parsing of the generic coverage report '/mnt/c/ambiente/workspace/xxx/target/site/clover/clover.xml'. Look at SonarQube documentation to know the expected XML format.: Unknown report version: null. This parser only handles version 1. -> [Help 1]

To Reproduce

mvn clean clover:setup test clover:aggregate clover:save-history clover:clover clover:log sonar:sonar

Expected behavior No error at the end of execution

Screenshots

Error

image

SonarQube + Clover plugin

image

Versions:

Additional context

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <!-- several parts omitted for brevity -->

    <properties>
        <java.version>1.8</java.version>

        <sonar.host.url>http://localhost:9001/</sonar.host.url>

        <sonar.coverageReportPaths>target/site/clover/clover.xml</sonar.coverageReportPaths>

        <clover.history.dir>${user.home}/.clover-history/${project.groupId}-${project.artifactId}</clover.history.dir>
    </properties>

    <build>

        <pluginManagement>

            <plugins>

                <plugin>
                    <groupId>org.sonarsource.scanner.maven</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>3.7.0.1746</version>
                </plugin>

            </plugins>

        </pluginManagement>

        <plugins>

            <plugin>
                <groupId>org.openclover</groupId>
                <artifactId>clover-maven-plugin</artifactId>
                <version>4.4.1</version>
                <configuration>
                    <generateHtml>false</generateHtml>
                    <generateXml>true</generateXml>
                </configuration>
            </plugin>

        </plugins>
    </build>

</project>
mhagnumdw commented 4 years ago

After breaking the command in two steps it worked.

Before

mvn clean clover:setup test clover:aggregate clover:save-history clover:clover clover:log sonar:sonar

After

# primeiro gera o report de test
mvn clean clover:setup test clover:aggregate clover:save-history clover:clover clover:log
# em seguida envia para o SonarQube
mvn sonar:sonar

Does anyone know why?

The log of the sonar-maven-plugin execution is different between both cases. If necessary I can attach it here.

fmcarvalho commented 4 years ago

In my case I am always getting Look at SonarQube documentation to know the expected XML format.: Unknown report version: null. Regardless running commands together or split in two steps.

Tony-Proum commented 4 years ago

Seems more related with how the maven plugin works than with the sonar plugin. There seems to be similar issue with some gradle executions. But this repository is not responsible of creating any report. It just allows to parse the generated report. Maybe could you post your question here : https://github.com/openclover/clover ?

Tony-Proum commented 4 years ago

Could you check please this new version of the documentation ? https://github.com/sfeir-open-source/sonar-clover/blob/1a6bf2f89659a749a4c384a0558067b7f9636ca0/README.md this may allows user to better understand the purpose of this plugin ?

mhagnumdw commented 4 years ago

Hi @Tony-Proum , I preferred to look around here: https://github.com/sfeir-open-source/sonar-clover/compare/feat/wrapper

And it looks good to me!

Tony-Proum commented 4 years ago

This branch were merge, I think this issue can now be closed.