Version note: references describe SonarQube Server 2025.2 behaviour. Check your server, scanner and edition requirements. These examples were not run against a live SonarQube server.
What this guide covers
SonarQube settings can come from the server, a project file, a build tool or scanner arguments. When the same property appears in more than one place, a higher-priority value can replace another value.
Before you start
Use the same commit and scanner type when comparing runs. Maven, Gradle and .NET scanners have build-specific settings; check their documentation as well as the general settings order.
Step 1: Find each definition
Search project files and pipeline scripts for the property. Check global and project settings in SonarQube. For the command-line scanner, command arguments normally override a project-file value. Some server-level exclusions cannot be overridden.
Step 2: Compare a file with a command override
Suppose sonar-project.properties contains:
sonar.projectKey=inventory
sonar.exclusions=src/generated/**
This command overrides that exclusion for this run:
sonar-scanner -Dsonar.exclusions='src/legacy/**'
It does not add the second path to the first. To exclude both, put both patterns in the effective setting.
Step 3: Check the working directory
Run from the directory containing the intended project file:
set -eu
pwd
test -f sonar-project.properties
sonar-scanner '-Dsonar.exclusions=src/generated/**,vendor/**'
Quotes keep the shell from altering wildcard characters. Be careful with diagnostic output: remove tokens and other secrets before sharing it.
Step 4: Keep one maintained definition
Remove duplicate settings where possible. Keep normal project settings in the repository and temporary overrides visible in the pipeline. Rerun the scan and inspect the analyzed file list.
Check the result
The scanner should include and exclude the files you intended. Record where the final value is set so the next change does not reintroduce a conflicting setting.
Conversation
0 commentsNo comments yet. Start the conversation below.