Groovy analysis in Sonarqube 10.6

We have recently upgraded our Sonarqube Enterprise Edition installation from 9.9 LTA to 10.6.

Since the upgrade the analysis of our Groovy project doesn’t function anymore. Before the upgrade it analysed the source code of our groovy project via the sonar-groovy-plugin-1.8.jar plugin.

But since the upgrade, it doesn’t detect any code anymore. We have the message No code files were found for analysis. in the code tab of our project on sonar.

SonarQube Groovy

I tried to :

  • manual add groovy as a language for the project (Project Settings → Quality Profiles)
  • deactivate (Configuration → General → Analyzers loading optimization → Analyzers loading optimization)

but it didn’t work.

Here are the logs of the sonar-scanner :

$ sonar-scanner -Dsonar.projectKey=groovyproject -Dsonar.projectName=groovyproject -Dsonar.sourceEncoding=UTF-8 -Dsonar.inclusions=vars/*,src/**, -Dsonar.exclusions=libPhing-2.16.0,.idea,templates,resources, -Dsonar.projectVersion=2.7.0 -Dsonar.scm.provider=git -Dsonar.branch.name=stable -Dsonar.sources=.
14:00:43.825 INFO  Scanner configuration file: /home/user/.sonar-scanner-6.1.0.4477-linux-x64/conf/sonar-scanner.properties
14:00:43.830 INFO  Project root configuration file: NONE
14:00:43.853 INFO  SonarScanner CLI 6.1.0.4477
14:00:43.855 INFO  Java 17.0.11 Eclipse Adoptium (64-bit)
14:00:43.856 INFO  Linux 5.15.153.1-microsoft-standard-WSL2 amd64
14:00:43.903 INFO  User cache: /home/user/.sonar/cache
14:00:45.285 INFO  JRE provisioning: os[linux], arch[x86_64]
14:00:45.801 INFO  Communicating with SonarQube Server 10.6.0.92116
14:00:46.910 INFO  Starting SonarScanner Engine...
14:00:46.911 INFO  Java 17.0.11 Eclipse Adoptium (64-bit)
14:00:48.243 INFO  Load global settings
14:00:48.385 INFO  Load global settings (done) | time=141ms
14:00:48.389 INFO  Server id: B6F56B17-AWEdFnd25mzAb74dsfqN
14:00:48.406 WARN  sonar.plugins.downloadOnlyRequired is false, so ALL available plugins will be downloaded
14:00:48.407 INFO  Loading all plugins
14:00:48.407 INFO  Load plugins index
14:00:48.434 INFO  Load plugins index (done) | time=28ms
14:00:48.435 INFO  Load/download plugins
14:01:12.413 INFO  Plugin [l10nfr] defines 'l10nen' as base plugin. This metadata can be removed from manifest of l10n plugins since version 5.2.
14:01:16.395 INFO  Load/download plugins (done) | time=27960ms
14:01:16.748 INFO  Loaded core extensions: developer-scanner
14:01:18.247 INFO  Process project properties
14:01:18.266 INFO  Process project properties (done) | time=20ms
14:01:18.276 INFO  Execute project builders
14:01:18.283 INFO  Execute project builders (done) | time=4ms
14:01:18.308 INFO  Project key: pic:groovyproject
14:01:18.309 INFO  Base dir: /home/user/Src/groovyproject
14:01:18.311 INFO  Working dir: /home/user/Src/groovyproject/.scannerwork
14:01:18.352 INFO  Load project settings for component key: 'pic:groovyproject'
14:01:18.403 INFO  Load project settings for component key: 'pic:groovyproject' (done) | time=51ms
14:01:18.672 INFO  Load project branches
14:01:18.710 INFO  Load project branches (done) | time=39ms
14:01:18.714 INFO  Load branch configuration
14:01:18.720 INFO  Found manual configuration of branch/PR analysis. Skipping automatic configuration.
14:01:18.725 INFO  Load branch configuration (done) | time=13ms
14:01:18.788 INFO  Load quality profiles
14:01:18.909 INFO  Load quality profiles (done) | time=122ms
14:01:18.979 INFO  Load active rules
14:01:23.718 INFO  Load active rules (done) | time=4739ms
14:01:23.724 INFO  Load analysis cache
14:01:23.758 INFO  Load analysis cache (404) | time=33ms
14:01:23.829 INFO  Branch name: stable
14:01:23.870 INFO  Preprocessing files...
14:01:24.097 INFO  0 languages detected in 35 preprocessed files
14:01:24.098 INFO  15 files ignored because of inclusion/exclusion patterns
14:01:24.098 INFO  0 files ignored because of scm ignore settings
14:01:24.171 INFO  Load project repositories
14:01:24.208 INFO  Load project repositories (done) | time=37ms
14:01:24.256 INFO  Indexing files...
14:01:24.257 INFO  Project configuration:
14:01:24.257 INFO    Included sources: vars/*, src/**
14:01:24.258 INFO    Excluded sources: libPhing-2.16.0, .idea, templates, resources
14:01:24.292 INFO  35 files indexed
14:01:24.295 INFO  ------------- Run sensors on module groovyproject
14:01:24.667 INFO  Load metrics repository
14:01:24.698 INFO  Load metrics repository (done) | time=31ms
14:01:29.099 INFO  Sensor Java Config Sensor [iac]
14:01:29.114 INFO  0 source files to be analyzed
14:01:29.151 INFO  0/0 source files have been analyzed
14:01:29.151 INFO  Sensor Java Config Sensor [iac] (done) | time=53ms
14:01:29.152 INFO  Sensor C# Project Type Information [csharp]
14:01:29.152 INFO  Sensor C# Project Type Information [csharp] (done) | time=1ms
14:01:29.152 INFO  Sensor C# Analysis Log [csharp]
14:01:29.162 INFO  Sensor C# Analysis Log [csharp] (done) | time=9ms
14:01:29.162 INFO  Sensor C# Properties [csharp]
14:01:29.162 INFO  Sensor C# Properties [csharp] (done) | time=0ms
14:01:29.162 INFO  Sensor HTML [web]
14:01:29.164 INFO  Sensor HTML [web] (done) | time=2ms
14:01:29.164 INFO  Sensor VB.NET Project Type Information [vbnet]
14:01:29.165 INFO  Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
14:01:29.165 INFO  Sensor VB.NET Analysis Log [vbnet]
14:01:29.174 INFO  Sensor VB.NET Analysis Log [vbnet] (done) | time=9ms
14:01:29.174 INFO  Sensor VB.NET Properties [vbnet]
14:01:29.174 INFO  Sensor VB.NET Properties [vbnet] (done) | time=0ms
14:01:29.174 INFO  Sensor JaCoCo XML Report Importer [jacoco]
14:01:29.175 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
14:01:29.175 INFO  No report imported, no coverage information will be imported by JaCoCo XML Report Importer
14:01:29.175 INFO  Sensor JaCoCo XML Report Importer [jacoco] (done) | time=1ms
14:01:29.175 INFO  Sensor CSS Rules [javascript]
14:01:29.176 INFO  No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
14:01:29.176 INFO  Sensor CSS Rules [javascript] (done) | time=1ms
14:01:29.176 INFO  Sensor ThymeLeaf template sensor [securityjavafrontend]
14:01:29.177 INFO  Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=1ms
14:01:29.177 INFO  Sensor IaC Docker Sensor [iac]
14:01:29.178 INFO  0 source files to be analyzed
14:01:29.253 INFO  0/0 source files have been analyzed
14:01:29.253 INFO  Sensor IaC Docker Sensor [iac] (done) | time=76ms
14:01:29.254 INFO  Sensor Serverless configuration file sensor [security]
14:01:29.254 INFO  0 Serverless function entries were found in the project
14:01:29.260 INFO  0 Serverless function handlers were kept as entrypoints
14:01:29.260 INFO  Sensor Serverless configuration file sensor [security] (done) | time=7ms
14:01:29.260 INFO  Sensor AWS SAM template file sensor [security]
14:01:29.261 INFO  Sensor AWS SAM template file sensor [security] (done) | time=1ms
14:01:29.261 INFO  Sensor AWS SAM Inline template file sensor [security]
14:01:29.261 INFO  Sensor AWS SAM Inline template file sensor [security] (done) | time=1ms
14:01:29.261 INFO  Sensor TextAndSecretsSensor [text]
14:01:29.262 INFO  Available processors: 12
14:01:29.262 INFO  Using 12 threads for analysis.
14:01:29.685 INFO  The property "sonar.tests" is not set. To improve the analysis accuracy, we categorize a file as a test file if any of the following is true:
  * The filename starts with "test"
  * The filename contains "test." or "tests."
  * Any directory in the file path is named: "doc", "docs", "test" or "tests"
  * Any directory in the file path has a name ending in "test" or "tests"

14:01:29.700 INFO  Using git CLI to retrieve untracked files
14:01:29.717 INFO  Analyzing language associated files and files included via "sonar.text.inclusions" that are tracked by git
14:01:29.722 INFO  Sensor TextAndSecretsSensor [text] (done) | time=461ms
14:01:29.723 INFO  Sensor javabugs [dbd]
14:01:29.724 INFO  Reading IR files from: /home/user/Src/groovyproject/.scannerwork/ir/java
14:01:29.725 INFO  No IR files have been included for analysis.
14:01:29.726 INFO  Sensor javabugs [dbd] (done) | time=2ms
14:01:29.726 INFO  Sensor pythonbugs [dbd]
14:01:29.726 INFO  Reading IR files from: /home/user/Src/groovyproject/.scannerwork/ir/python
14:01:29.726 INFO  No IR files have been included for analysis.
14:01:29.726 INFO  Sensor pythonbugs [dbd] (done) | time=0ms
14:01:29.726 INFO  Sensor EnterpriseSecretsSensor [textenterprise]
14:01:29.727 INFO  Available processors: 12
14:01:29.727 INFO  Using 12 threads for analysis.
14:01:29.738 INFO  The property "sonar.tests" is not set. To improve the analysis accuracy, we categorize a file as a test file if any of the following is true:
  * The filename starts with "test"
  * The filename contains "test." or "tests."
  * Any directory in the file path is named: "doc", "docs", "test" or "tests"
  * Any directory in the file path has a name ending in "test" or "tests"

14:01:29.738 INFO  Sensor EnterpriseSecretsSensor [textenterprise] (done) | time=14ms
14:01:29.738 INFO  Sensor JavaSecuritySensor [security]
14:01:29.743 INFO  Enabled taint analysis rules: S2076, S2078, S2083, S2091, S2631, S3649, S5131, S5135, S5144, S5145, S5146, S5147, S5334, S5883, S6096, S6173, S6287, S6350, S6384, S6390, S6398, S6399, S6547, S6549
14:01:29.744 INFO  Load type hierarchy and UCFGs: Starting
14:01:29.745 INFO  Load type hierarchy: Starting
14:01:29.745 INFO  Reading type hierarchy from: /home/user/Src/groovyproject/.scannerwork/ucfg2/java
14:01:29.746 INFO  Read 0 type definitions
14:01:29.751 INFO  Load type hierarchy: Time spent was 00:00:00.005
14:01:29.752 INFO  Load UCFGs: Starting
14:01:29.753 INFO  Load UCFGs: Time spent was 00:00:00.000
14:01:29.753 INFO  Load type hierarchy and UCFGs: Time spent was 00:00:00.007
14:01:29.753 INFO  No UCFGs have been included for analysis.
14:01:29.791 INFO  java security sensor: Time spent was 00:00:00.050
14:01:29.792 INFO  java security sensor: Begin: 2024-09-24T12:01:29.741163239Z, End: 2024-09-24T12:01:29.791287198Z, Duration: 00:00:00.050
  Load type hierarchy and UCFGs: Begin: 2024-09-24T12:01:29.744006522Z, End: 2024-09-24T12:01:29.751603585Z, Duration: 00:00:00.007
    Load type hierarchy: Begin: 2024-09-24T12:01:29.744215810Z, End: 2024-09-24T12:01:29.749429267Z, Duration: 00:00:00.005
    Load UCFGs: Begin: 2024-09-24T12:01:29.750758405Z, End: 2024-09-24T12:01:29.750962628Z, Duration: 00:00:00.000
14:01:29.793 INFO  java security sensor peak memory: 258 MB
14:01:29.795 INFO  Sensor JavaSecuritySensor [security] (done) | time=56ms
14:01:29.795 INFO  Sensor CSharpSecuritySensor [security]
14:01:29.795 INFO  Enabled taint analysis rules: S2076, S2078, S2083, S2091, S2631, S3649, S5131, S5135, S5144, S5145, S5146, S5334, S5883, S6096, S6173, S6287, S6350, S6399, S6639, S6641
14:01:29.795 INFO  Load type hierarchy and UCFGs: Starting
14:01:29.796 INFO  Load type hierarchy: Starting
14:01:29.796 INFO  Reading type hierarchy from: /home/user/Src/groovyproject/ucfg2/cs
14:01:29.796 INFO  Read 0 type definitions
14:01:29.796 INFO  Load type hierarchy: Time spent was 00:00:00.000
14:01:29.797 INFO  Load UCFGs: Starting
14:01:29.797 INFO  Load UCFGs: Time spent was 00:00:00.000
14:01:29.797 INFO  Load type hierarchy and UCFGs: Time spent was 00:00:00.000
14:01:29.797 INFO  No UCFGs have been included for analysis.
14:01:29.797 INFO  csharp security sensor: Time spent was 00:00:00.001
14:01:29.798 INFO  csharp security sensor: Begin: 2024-09-24T12:01:29.794705837Z, End: 2024-09-24T12:01:29.796227839Z, Duration: 00:00:00.001
  Load type hierarchy and UCFGs: Begin: 2024-09-24T12:01:29.795028120Z, End: 2024-09-24T12:01:29.795790495Z, Duration: 00:00:00.000
    Load type hierarchy: Begin: 2024-09-24T12:01:29.795056502Z, End: 2024-09-24T12:01:29.795383495Z, Duration: 00:00:00.000
    Load UCFGs: Begin: 2024-09-24T12:01:29.795617338Z, End: 2024-09-24T12:01:29.795686029Z, Duration: 00:00:00.000
14:01:29.798 INFO  csharp security sensor peak memory: 258 MB
14:01:29.798 INFO  Sensor CSharpSecuritySensor [security] (done) | time=2ms
14:01:29.798 INFO  Sensor PhpSecuritySensor [security]
14:01:29.799 INFO  Enabled taint analysis rules: S2076, S2078, S2083, S2091, S2631, S3649, S5131, S5135, S5144, S5145, S5146, S5334, S5335, S5883, S6173, S6287, S6350
14:01:29.799 INFO  Load type hierarchy and UCFGs: Starting
14:01:29.799 INFO  Load type hierarchy: Starting
14:01:29.799 INFO  Reading type hierarchy from: /home/user/Src/groovyproject/.scannerwork/ucfg2/php
14:01:29.800 INFO  Read 0 type definitions
14:01:29.800 INFO  Load type hierarchy: Time spent was 00:00:00.000
14:01:29.800 INFO  Load UCFGs: Starting
14:01:29.800 INFO  Load UCFGs: Time spent was 00:00:00.000
14:01:29.801 INFO  Load type hierarchy and UCFGs: Time spent was 00:00:00.000
14:01:29.801 INFO  No UCFGs have been included for analysis.
14:01:29.801 INFO  php security sensor: Time spent was 00:00:00.001
14:01:29.801 INFO  php security sensor: Begin: 2024-09-24T12:01:29.797083245Z, End: 2024-09-24T12:01:29.798225987Z, Duration: 00:00:00.001
  Load type hierarchy and UCFGs: Begin: 2024-09-24T12:01:29.797306486Z, End: 2024-09-24T12:01:29.797778415Z, Duration: 00:00:00.000
    Load type hierarchy: Begin: 2024-09-24T12:01:29.797330311Z, End: 2024-09-24T12:01:29.797523617Z, Duration: 00:00:00.000
    Load UCFGs: Begin: 2024-09-24T12:01:29.797666142Z, End: 2024-09-24T12:01:29.797702979Z, Duration: 00:00:00.000
14:01:29.801 INFO  php security sensor peak memory: 258 MB
14:01:29.802 INFO  Sensor PhpSecuritySensor [security] (done) | time=2ms
14:01:29.802 INFO  Sensor PythonSecuritySensor [security]
14:01:29.802 INFO  Enabled taint analysis rules: S2076, S2078, S2083, S2091, S2631, S3649, S5131, S5135, S5144, S5145, S5146, S5147, S5334, S5496, S6287, S6350, S6639, S6680, S6776, S6839
14:01:29.802 INFO  Load type hierarchy and UCFGs: Starting
14:01:29.802 INFO  Load type hierarchy: Starting
14:01:29.802 INFO  Reading type hierarchy from: /home/user/Src/groovyproject/.scannerwork/ucfg2/python
14:01:29.802 INFO  Read 0 type definitions
14:01:29.802 INFO  Load type hierarchy: Time spent was 00:00:00.000
14:01:29.802 INFO  Load UCFGs: Starting
14:01:29.803 INFO  Load UCFGs: Time spent was 00:00:00.000
14:01:29.803 INFO  Load type hierarchy and UCFGs: Time spent was 00:00:00.001
14:01:29.803 INFO  No UCFGs have been included for analysis.
14:01:29.803 INFO  python security sensor: Time spent was 00:00:00.002
14:01:29.803 INFO  python security sensor: Begin: 2024-09-24T12:01:29.799250574Z, End: 2024-09-24T12:01:29.801264026Z, Duration: 00:00:00.002
  Load type hierarchy and UCFGs: Begin: 2024-09-24T12:01:29.799608764Z, End: 2024-09-24T12:01:29.800680286Z, Duration: 00:00:00.001
    Load type hierarchy: Begin: 2024-09-24T12:01:29.799642788Z, End: 2024-09-24T12:01:29.800066409Z, Duration: 00:00:00.000
    Load UCFGs: Begin: 2024-09-24T12:01:29.800349986Z, End: 2024-09-24T12:01:29.800433325Z, Duration: 00:00:00.000
14:01:29.803 INFO  python security sensor peak memory: 258 MB
14:01:29.803 INFO  Sensor PythonSecuritySensor [security] (done) | time=3ms
14:01:29.804 INFO  Sensor JsSecuritySensor [security]
14:01:29.804 INFO  Enabled taint analysis rules: S5131, S6096, S5144, S2631, S5696, S5334, S2083, S3649, S5883, S5147, S6287, S2076, S6105, S6350, S5146
14:01:29.805 INFO  Load type hierarchy and UCFGs: Starting
14:01:29.805 INFO  Load type hierarchy: Starting
14:01:29.805 INFO  Reading type hierarchy from: /home/user/Src/groovyproject/.scannerwork/ucfg2/js
14:01:29.805 INFO  Read 0 type definitions
14:01:29.806 INFO  Load type hierarchy: Time spent was 00:00:00.000
14:01:29.806 INFO  Load UCFGs: Starting
14:01:29.806 INFO  Load UCFGs: Time spent was 00:00:00.000
14:01:29.807 INFO  Load type hierarchy and UCFGs: Time spent was 00:00:00.000
14:01:29.807 INFO  No UCFGs have been included for analysis.
14:01:29.808 INFO  js security sensor: Time spent was 00:00:00.001
14:01:29.810 INFO  js security sensor: Begin: 2024-09-24T12:01:29.802180804Z, End: 2024-09-24T12:01:29.803690778Z, Duration: 00:00:00.001
  Load type hierarchy and UCFGs: Begin: 2024-09-24T12:01:29.802624825Z, End: 2024-09-24T12:01:29.803213175Z, Duration: 00:00:00.000
    Load type hierarchy: Begin: 2024-09-24T12:01:29.802657747Z, End: 2024-09-24T12:01:29.802943161Z, Duration: 00:00:00.000
    Load UCFGs: Begin: 2024-09-24T12:01:29.803085006Z, End: 2024-09-24T12:01:29.803129540Z, Duration: 00:00:00.000
14:01:29.811 INFO  js security sensor peak memory: 258 MB
14:01:29.811 INFO  Sensor JsSecuritySensor [security] (done) | time=2ms
14:01:29.814 INFO  ------------- Run sensors on project
14:01:29.941 INFO  Sensor Analysis Warnings import [csharp]
14:01:29.942 INFO  Sensor Analysis Warnings import [csharp] (done) | time=0ms
14:01:29.942 INFO  Sensor Zero Coverage Sensor
14:01:29.947 INFO  Sensor Zero Coverage Sensor (done) | time=4ms
14:01:29.953 INFO  CPD Executor Calculating CPD for 0 files
14:01:29.953 INFO  CPD Executor CPD calculation finished (done) | time=0ms
14:01:29.965 INFO  SCM revision ID '057f8e0a031e6976d000f3902620d9040ec6e416'
14:01:30.060 INFO  Load New Code definition
14:01:30.084 INFO  Load New Code definition (done) | time=24ms
14:01:30.090 INFO  Analysis report generated in 130ms, dir size=286.4 kB
14:01:30.098 INFO  Analysis report compressed in 7ms, zip size=36.8 kB
14:01:30.159 INFO  Analysis report uploaded in 61ms
14:01:30.160 INFO  ANALYSIS SUCCESSFUL, you can find the results at: http://sonarhost/dashboard?id=pic%3Agroovyproject&branch=stable
14:01:30.160 INFO  Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
14:01:30.160 INFO  More about the report processing at http://sonarhost/api/ce/task?id=121790b4-3c5f-464e-a50a-106f417b3644
14:01:30.167 INFO  Analysis total time: 13.419 s
14:01:30.169 INFO  SonarScanner Engine completed successfully
14:01:30.501 INFO  EXECUTION SUCCESS
14:01:30.502 INFO  Total time: 46.678s

Hey there.

You should probably raise an issue with GitHub - Inform-Software/sonar-groovy: SonarQube plugin for Groovy, although this one might already be relevant: Default value for sonar.lang.patterns.grvy does not apply in newer SonarQube versions · Issue #199 · Inform-Software/sonar-groovy · GitHub

1 Like

adding -Dsonar.lang.patterns.grvy="**/*.groovy" to the sonar-scanner command line resolves the bug.

But it’s only a workaround.

Thanks @Colin