Sonar Scanner Skipping Scans Even if sonar.skip flag is not explicitly defined

Hi All , We have a Java Project Where we want to run run sonar scans using sonar scanner for maven but looks like the scans ae not happening and the scans are skipped without any failure being reported.
below are some DEBUG Traces :
[DEBUG] Imported: < maven.api
[DEBUG] Populating class realm plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.2
[DEBUG] Included: org.sonarsource.scanner.maven:sonar-maven-plugin:jar:3.2
[DEBUG] Included: org.apache.maven.shared:maven-dependency-tree:jar:2.2
[DEBUG] Included: org.codehaus.plexus:plexus-component-annotations:jar:1.5.5
[DEBUG] Included: org.eclipse.aether:aether-util:jar:0.9.0.M2
[DEBUG] Included: org.sonatype.plexus:plexus-sec-dispatcher:jar:1.4
[DEBUG] Included: org.sonatype.plexus:plexus-cipher:jar:1.4
[DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:3.0.22
[DEBUG] Included: org.sonarsource.scanner.api:sonar-scanner-api:jar:2.8
[DEBUG] Included: commons-lang:commons-lang:jar:2.6
[DEBUG] Included: com.google.code.findbugs:jsr305:jar:2.0.3
[DEBUG] Configuring mojo org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar from plugin realm ClassRealm[plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.2, parent: sun.misc.Launcher$AppClassLoader@7852e922]
[DEBUG] Configuring mojo ‘org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar’ with basic configurator →
[DEBUG] (f) localRepository = id: local
url: file:///home/jenkins/.m2/repository/
layout: default
snapshots: [enabled => true, update => always]
releases: [enabled => true, update => always]
blocked: false

[DEBUG] (f) session = org.apache.maven.execution.MavenSession@a2341c6
[DEBUG] (f) skip = true
[DEBUG] – end configuration –
[DEBUG] Lifecycle default → [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean → [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site → [pre-site, site, post-site, site-deploy]
[INFO] 11:23:32.848 sonar.skip = true: Skipping analysis
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for XXXXX XXXXXXXXX-SNAPSHOT:
[INFO]
[INFO] root_module … SUCCESS [ 2.697 s]
[INFO] child_module1 … SKIPPED
[INFO] child_module2 … SKIPPED
[INFO] child_module3 … SKIPPED
[INFO] child_module4 … SKIPPED
[INFO] child_module5 … SKIPPED
[INFO] child_module6 … SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.330 s
[INFO] Finished at: 2022-07-13T11:23:32+10:00

Maven command : mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar -U -B -X -s settings.xml -Drevision=XXXXXXXXXXX-SNAPSHOT -P main-snapshot-profile

Questions :

  1. Why is the sonar analysis getting skipped on its own ? .We don’t have anything in pom files to skip the scans explicitly
    SonarQube version : * Enterprise Edition
  • Version 8.9.6

Welcome :slight_smile:

at first you should try with the latest version of the Maven plugin, as 3.2 is VERY old,
see SonarScanner for Maven | SonarQube Docs

we use SonarScanner for Maven version 3.9.1 with Sonarqube Enterprise 9.5.0

Gilbert