SonarQube to take the coverage from Clover.xml

Viewed 4739

I have generated a clover.xml report for my service. I want to integrate that with my SonarQube report which is not showing the coverage at all. I am not sure what exact plugin to add to my pom.xml so sonar can read it. Here is part of my pom.xml:

<plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>2.7.1</version>
                    <executions>
                        <execution>
                            <id>add-test-source</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>add-test-source</goal>
                            </goals>
                            <configuration>
                                <sources>
                                    <source>src/it/java</source>
                                </sources>
                            </configuration>
                        </execution>
                    </executions></plugin><plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>maven-clover2-plugin</artifactId>
            <configuration>
                <excludes>
                    <exclude>**/*Constants.java</exclude>       
                    <exclude>**/*LatestTimeSeriesDataServiceImpl.java</exclude>
                    <exclude>**/TestWebRequest.java</exclude>
                </excludes>
                <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
                <sonar.core.codeCoveragePlugin>clover</sonar.core.codeCoveragePlugin>
                <sonar.clover.reportPath>target\site\clover\clover.xml</sonar.clover.reportPath>
                <sonar.surefire.reportsPath>target\surefire-reports</sonar.surefire.reportsPath>
                <sonar.core.codeCoveragePlugin>clover</sonar.core.codeCoveragePlugin>
                <sonar.clover.version>${clover.version}</sonar.clover.version>
            </configuration>

and this is part of my setting.xml:

<id>sonar</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <sonar.jdbc.url></sonar.jdbc.url>
            <sonar.jdbc.driver></sonar.jdbc.driver>
            <sonar.jdbc.username></sonar.jdbc.username>
            <sonar.jdbc.password></sonar.jdbc.password>
            <sonar.host.url>http://localhost:9000/</sonar.host.url>
    </properties>

I hided some values I am not sure if they are confidential or not..

these are the values to my sonar-project.properties:

sonar.projectKey=org.sonarqube:java
sonar.projectName=org.sonarqube:java
sonar.projectVersion=1.0
sonar.sources=path
sonar.tests=path
sonar.language=java
sonar.sourceEncoding=UTF-8
sonar.core.codeCoveragePlugin=clover
sonar.clover.reportPath=target/site/clover/clover.xml
sonar.java.binaries=target/classes
sonar.dynamicAnalysis=reuseReports

in addition i tried to enforce the properties through command line as well:

mvn sonar:sonar -s menlo_settings.xml -Dsonar.host.url=http://localhost:9000/ org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar -Dsonar.core.codeCoveragePlugin=clover -Dsonar.clover.reportPath=target/site/clover/clover.xml

Nothing is working and I am frustrated!! If anyone know about it please let me know!

0 Answers
Related