I’m struggling upgrading a very old Sonar instance into latest.
My problem is that I’m not able to see surefire(junit) reports in new dashboard. I mean I cannot see which test did fail and the messages related. I can only see in which java class the failed test is.
In my previous Sonar 5.6.7 version, I was able to see all that information.
My current SonarQube is:
- Community Edition Version 10.0 (build 68432)
- Basic Docker deployment
- sonar-maven-plugin:3.9.1.2184:sonar
- jacoco 0.8.10
I created a very basic Java maven project with a few junit tests. One of them is failing.
I tried playing with the sonar.junit.reportPaths property, but its value of target\surefire-reports seems correct.
Any idea is welcome !
Please see my pom.xml, the plugin log, and the “show measure” page:
<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>
<groupId>com.company</groupId>
<artifactId>sonartest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<!-- JaCoCo Properties -->
<jacoco.version>0.8.6</jacoco.version>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.jacoco.reportPath>${project.basedir}/target/jacoco.exec</sonar.jacoco.reportPath>
<sonar.language>java</sonar.language>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<argLine> --illegal-access=permit</argLine>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>jacoco</id>
<activation>
<property>
<name>jacoco</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.10</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>generate-code-coverage-report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<argLine>@{argLine} -Xmx512m</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
And the processing log:
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< com.company:sonartest >------------------------
[INFO] Building sonartest 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:3.9.1.2184:sonar (default-cli) @ sonartest ---
[INFO] User cache: C:\Users\svetsch\.sonar\cache
[INFO] SonarQube version: 10.0.0.68432
[INFO] Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
[INFO] Load global settings
[INFO] Load global settings (done) | time=131ms
[INFO] Server id: 147B411E-AYf61rdAk6S6gVccv-ES
[INFO] User cache: C:\Users\svetsch\.sonar\cache
[INFO] Load/download plugins
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=68ms
[INFO] Load/download plugins (done) | time=126ms
[INFO] Process project properties
[INFO] Process project properties (done) | time=9ms
[INFO] Execute project builders
[INFO] Execute project builders (done) | time=1ms
[INFO] Project key: sonartest
[INFO] Base dir: C:\source\eclipse-workspaces\WorkspaceSonar\sonartest
[INFO] Working dir: C:\source\eclipse-workspaces\WorkspaceSonar\sonartest\target\sonar
[INFO] Load project settings for component key: 'sonartest'
[INFO] Load project settings for component key: 'sonartest' (done) | time=56ms
[WARNING] SCM provider autodetection failed. Please use "sonar.scm.provider" to define SCM of your project, or disable the SCM Sensor in the project settings.
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=106ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=3735ms
[INFO] Load analysis cache
[INFO] Load analysis cache (104 bytes) | time=38ms
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=46ms
[INFO] Indexing files...
[INFO] Project configuration:
[INFO] 3 files indexed
[INFO] Quality profile for java: Sonar way
[INFO] Quality profile for xml: Sonar way
[INFO] ------------- Run sensors on module 'sonartest'
[INFO] Load metrics repository
[INFO] Load metrics repository (done) | time=50ms
[INFO] Sensor JavaSensor [java]
[INFO] Configured Java source version (sonar.java.source): 11
[INFO] JavaClasspath initialization
[INFO] JavaClasspath initialization (done) | time=6ms
[INFO] JavaTestClasspath initialization
[INFO] JavaTestClasspath initialization (done) | time=1ms
[INFO] Server-side caching is enabled. The Java analyzer will not try to leverage data from a previous analysis.
[INFO] Using ECJ batch to parse 1 Main java source files with batch size 500 KB.
[INFO] Starting batch processing.
[INFO] The Java analyzer cannot skip unchanged files in this context. A full analysis is performed for all files.
[INFO] 100% analyzed
[INFO] Batch processing: Done.
[INFO] Did not optimize analysis for any files, performed a full analysis for all 1 files.
[INFO] Using ECJ batch to parse 1 Test java source files with batch size 500 KB.
[INFO] Starting batch processing.
[INFO] 100% analyzed
[INFO] Batch processing: Done.
[INFO] Did not optimize analysis for any files, performed a full analysis for all 1 files.
[INFO] No "Generated" source files to scan.
[INFO] Sensor JavaSensor [java] (done) | time=738ms
[INFO] Sensor JaCoCo XML Report Importer [jacoco]
[INFO] 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
[INFO] Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list.
[INFO] Sensor JaCoCo XML Report Importer [jacoco] (done) | time=18ms
[INFO] Sensor CSS Rules [javascript]
[INFO] No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
[INFO] Sensor CSS Rules [javascript] (done) | time=1ms
[INFO] Sensor C# Project Type Information [csharp]
[INFO] Sensor C# Project Type Information [csharp] (done) | time=0ms
[INFO] Sensor C# Analysis Log [csharp]
[INFO] Sensor C# Analysis Log [csharp] (done) | time=12ms
[INFO] Sensor C# Properties [csharp]
[INFO] Sensor C# Properties [csharp] (done) | time=1ms
[INFO] Sensor SurefireSensor [java]
[INFO] parsing [C:\source\eclipse-workspaces\WorkspaceSonar\sonartest\target\surefire-reports]
[INFO] Sensor SurefireSensor [java] (done) | time=64ms
[INFO] Sensor Removed properties sensor [java]
[WARNING] Property 'sonar.jacoco.reportPath' is no longer supported. Use JaCoCo's xml report and sonar-jacoco plugin.
[INFO] Sensor Removed properties sensor [java] (done) | time=1ms
[INFO] Sensor HTML [web]
[INFO] Sensor HTML [web] (done) | time=2ms
[INFO] Sensor XML Sensor [xml]
[INFO] 1 source file to be analyzed
[INFO] 1/1 source file has been analyzed
[INFO] Sensor XML Sensor [xml] (done) | time=144ms
[INFO] Sensor TextAndSecretsSensor [text]
[INFO] 3 source files to be analyzed
[INFO] 3/3 source files have been analyzed
[INFO] Sensor TextAndSecretsSensor [text] (done) | time=13ms
[INFO] Sensor VB.NET Project Type Information [vbnet]
[INFO] Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
[INFO] Sensor VB.NET Analysis Log [vbnet]
[INFO] Sensor VB.NET Analysis Log [vbnet] (done) | time=13ms
[INFO] Sensor VB.NET Properties [vbnet]
[INFO] Sensor VB.NET Properties [vbnet] (done) | time=0ms
[INFO] Sensor IaC Docker Sensor [iac]
[INFO] 0 source files to be analyzed
[INFO] 0/0 source files have been analyzed
[INFO] Sensor IaC Docker Sensor [iac] (done) | time=55ms
[INFO] ------------- Run sensors on project
[INFO] Sensor Analysis Warnings import [csharp]
[INFO] Sensor Analysis Warnings import [csharp] (done) | time=0ms
[INFO] Sensor Zero Coverage Sensor
[INFO] Sensor Zero Coverage Sensor (done) | time=0ms
[INFO] Sensor Java CPD Block Indexer
[INFO] Sensor Java CPD Block Indexer (done) | time=7ms
[INFO] SCM Publisher No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
[INFO] CPD Executor 1 file had no CPD blocks
[INFO] CPD Executor Calculating CPD for 0 files
[INFO] CPD Executor CPD calculation finished (done) | time=0ms
[INFO] Analysis report generated in 55ms, dir size=134.1 kB
[INFO] Analysis report compressed in 42ms, zip size=21.1 kB
[INFO] Analysis report uploaded in 56ms
[INFO] ANALYSIS SUCCESSFUL, you can find the results at: http://myserver.com:19000/dashboard?id=sonartest
[INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
[INFO] More about the report processing at http://myserver.com:19000/api/ce/task?id=AYgB57Gmk6S6gVccwIBY
[INFO] Analysis total time: 7.123 s
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.750 s
[INFO] Finished at: 2023-05-09T21:05:41+02:00
[INFO] ------------------------------------------------------------------------