Unit test results are not displayed in SonarQube

I have configured Jenkins build to run SonarQube and I can see all results except code coverage. I can see the xml and txt files in the surefire-reports directory and I can see the jacoco.exec as well, so I am puzzled what I am missing, which I suspect will be something super basic.

SonarQube version: 6.3.1 Jenkins: 2.46.2

Here is my SonarQube config in Jenkins:

# metadata
sonar.projectName=${JOB_NAME}
sonar.projectVersion = 0.1

#path to source
sonar.projectBasedDir=${WORKSPACE}
sonar.sources=src/... (removed specific path)
sonar.binaries=target/classes


#report location
sonar.junit.reportPaths=${project.build.directory}/target/surefire-reports sonar.jacoco.reportPaths=${project.build.directory}/target/surefire-reports/jacoco.exec

#testing parms
sonar.verbose=true
sonar.tests=src/test/java
sonar.language=java

      

Here is the plugin data from my POM:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.20</version>
    <configuration>
    <argLine>${argLine}</argLine>
    <runOrder>random</runOrder>
    </configuration>
</plugin>
<plugin>
    <groupId>org.jacoco</groupId> 
    <artifactId>jacoco-maven-plugin</artifactId> 
    <version>0.7.9</version> 
    <configuration>
         <destFile>${basedir}/target/surefire-reports/jacoco.exec</destFile>
         <dataFile>${basedir}/target/surefire-reports/jacoco.exec</dataFile>
    <output>file</output>
    <append>true</append>
    </configuration>
    <executions>
         <execution>
            <id>jacoco-initialize</id>
                <goals>
                    <goal>prepare-agent</goal>
                </goals>
         </execution>
         <execution>
            <id>report</id>
                <phase>prepare-package</phase>
                <goals>
                    <goal>report</goal>
                </goals>
          </execution>

         </executions>
        </plugin>
          <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-junit47</artifactId>
            <version>2.20</version>
          </dependency>

      

+3


source to share


1 answer


Maybe the report path argument should be:

sonar.junit.reportsPath



not

sonar.junit.reportPaths

-1


source







All Articles