Hey guys,
I am using the newest SonarQube-Version and I can see CodeSmells, Vulnerabilities, and Bugs. But my Coverage stays at 0.00%.
I am using Java 11/Maven.
I already added the Jococo plugin but I still don’t get any Coverage.
My pom.xml looks like this:
4.0.0
<groupId>com.${company-name}.sonar-scanner</groupId>
<!-- it's recommended to follow the pattern "sonar-{key}-plugin", for example "sonar-myphp-plugin" -->
<artifactId>sonar-maven-plugin</artifactId>
<version>1.0</version>
<name>Sonar-Results</name>
<description>Prints the results and marks important numbers</description>
<!-- set file encoding to utf-8 -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.apiVersion>7.1</sonar.apiVersion>
</properties>
<!-- this is important for sonar-packaging-maven-plugin -->
<packaging>sonar-plugin</packaging>
<dependencies>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-plugin-api</artifactId>
<!-- minimal version of SonarQube to support. -->
<version>6.7</version>
<!-- mandatory scope -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
</dependency>
<dependency>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-plugin-api</artifactId>
<version>5.1-RC2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId>
<artifactId>sonar-packaging-maven-plugin</artifactId>
<version>1.18.0.372</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.10</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.26</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.7.0.1746</version>
</plugin>
<plugin>
<groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId>
<artifactId>sonar-packaging-maven-plugin</artifactId>
<version>1.18.0.372</version>
<extensions>true</extensions>
<configuration>
<!-- the entry-point class that extends org.sonar.api.SonarPlugin -->
<pluginClass>SonarResults.Main</pluginClass>
<pluginDescription>packaging-maven</pluginDescription>
<!-- advanced properties can be set here. See paragraph "Advanced Build Properties". -->
</configuration>
</plugin>
<!--is up and working we need to add the jacoco maven plugin as shown below.-->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Sorry if the pom.xml looks a bit weird it is my first time with maven