Coverage analysis don't works for me

Hi!
I try to run a sonar analysis with maven and view results in the Sonarqube server (coverage with Jacoco).

Versions:
SonarQube: 6.7
sonar-maven-plugin: 3.7.0.1746
jacoco-maven-plugin: 0.8.6

In POM file:

  <properties>
    <sonar.jdbc.dialect>mssql</sonar.jdbc.dialect>
    <sonar.projectKey>name</sonar.projectKey>
    <sonar.projectName>name</sonar.projectName>
    <sonar.projectVersion>1.0.0-SNAPSHOT</sonar.projectVersion>
    <sonar.sources>src/test/java</sonar.sources>
    <sonar.language>java</sonar.language>
    <sonar.binaries>target/classes</sonar.binaries>
    <sonar.tests>src/test/java/unitary</sonar.tests>
    <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
    <sonar.junit.reportsPath>target/surefire-reports</sonar.junit.reportsPath>
    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
    <sonar.jacoco.reportPath>target/jacoco.exec</sonar.jacoco.reportPath>
    <sonar.java.coveragePlugin>plugin</sonar.java.coveragePlugin>
  </properties>

  <plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.8.6</version>
    <executions>
      <execution>
        <goals>
          <goal>prepare-agent</goal>
          <goal>prepare-agent-integration</goal>
          <goal>report</goal>
          <goal>report-integration</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

In settings.xml:

  <pluginGroups>
    <pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
  </pluginGroups>

and

	</profile>
	        <profile>
            <id>sonar</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <!-- Optional URL to server. Default value is http://localhost:9000 -->
                <sonar.host.url>
                  https://sonar.url
                </sonar.host.url>
		<sonar.login>login</sonar.login>
            </properties>
        </profile>

I run:
mvn clean install

and
mvn sonar:sonar

And console shows me:

[INFO] Analysing /<route>/target/jacoco.exec
[WARNING] Coverage information was not collected. Perhaps you forget to include debug information into compiled classes?

Analysis is show in Sonarqube with 0 bugs and without coverage info

¿What is happend?

Thanks!

Where were the jacoco.exec files generated?

Hi!
In the right path, //target

My problem now is the next:
[INFO] JaCoCo report not found: ‘/mnt/mesos/sandbox/workspace/c/target/jacoco-it.exec’
[INFO] JaCoCo report not found: ‘/mnt/mesos/sandbox/workspace/c/target/jacoco.exec’

Server have a properties configuration:
/tmp/tools/hudson.plugins.sonar.SonarRunnerInstallation/sonarqube_scanner/conf/sonar-scanner.properties

is it possible than the report files must be in this folder?

Hi,

You’ve added a whole lot of properties to your pom file, many of them unnecessarily. TBH, my first step here would be to comment out or clean out all of those properties, reanalyze & see what you got.

 
Ann

Thank you very much!

Finally I have chosen to use sonar-scanner with a properties file, and it’s works!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.