# Analysis parameters

Project analysis settings can be configured in multiple places. Each plugin and language analyzer adds its own properties which can be defined in the SonarQube UI; these properties can also be defined as analysis parameters, however, the descriptions of those properties and the best place to set them is *in the UI* when possible. Only parameters set through the UI are reusable for subsequent analysis and there is a structure to the way parameters are read by the scanner.

Here is the hierarchy in order of precedence:

![Diagram showing settings hierarchy.](https://931701944-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FguPtldYmKsIetAs13CP3%2Fuploads%2Fgit-blob-b0bffc5c8c2fb56f9b91e54bef8b833da9f71549%2Fc9667d9d76afdceb73b59b271fc872fb10999446.png?alt=media)

Diagram showing settings hierarchy.

1. *Global properties*: Apply to all projects. Defined in the UI in **Administration** > **Configuration** > **General Settings**
2. *Project properties*: Apply to one project only. At project level, defined in the UI in **Project Settings** > **General Settings**
3. *Project analysis parameters*: Defined in a project analysis configuration file or scanner configuration file
4. *Analysis / Command line parameters*: Defined when launching an analysis with `-D` on the command line

Note that only parameters set through the UI are stored in the database. For example, if you override the `sonar.exclusions` parameter via the command line for a specific project, it will not be stored in the database. Subsequent analyses, or analyses in SonarLint with connected mode, would still be executed with the exclusions defined in the UI and therefore stored in the DB.

Most of the property keys shown in the interface at both global and project levels can also be set as analysis parameters, but the parameters listed below can *only* be set at analysis time.

For language-specific parameters related to test coverage and execution, see [overview](https://docs.sonarsource.com/sonarqube-server/10.1/analyzing-source-code/test-coverage/overview "mention"). For language-specific parameters related to external issue reports, see [importing-third-party-issues](https://docs.sonarsource.com/sonarqube-server/10.1/analyzing-source-code/importing-external-issues/importing-third-party-issues "mention"). And to learn more about controlling the scope of your analysis, see the page on [analysis-scope](https://docs.sonarsource.com/sonarqube-server/10.1/project-administration/analysis-scope "mention"). &#x20;

{% hint style="info" %}
Analysis parameters are case-sensitive.
{% endhint %}

### Mandatory parameters <a href="#mandatory-parameters" id="mandatory-parameters"></a>

|            |
| ---------- |
| **Server** |

|                  |                 |                         |
| ---------------- | --------------- | ----------------------- |
| **Key**          | **Description** | **Default**             |
| `sonar.host.url` | the server URL  | `http://localhost:9000` |

#### Project configuration <a href="#project-configuration" id="project-configuration"></a>

|                    |                                                                                                                         |                                                               |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| **Key**            | **Description**                                                                                                         | **Default**                                                   |
| `sonar.projectKey` | The project’s unique key. Allowed characters are: letters, numbers, `-`, `_`, `.` and `:`, with at least one non-digit. | For Maven projects, this defaults to `<groupId>:<artifactId>` |

### Optional parameters <a href="#optional-parameters" id="optional-parameters"></a>

#### Project identity <a href="#project-identity" id="project-identity"></a>

|                        |                                                                  |                                                                                                                                     |
| ---------------------- | ---------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| **Key**                | **Description**                                                  | **Default**                                                                                                                         |
| `sonar.projectName`    | Name of the project that will be displayed on the web interface. | `<name>` for Maven projects, otherwise project key. If not provided and there is already a name in the DB, it won’t be overwritten. |
| `sonar.projectVersion` | The project version.                                             | `<version>` for Maven projects, otherwise "not provided". *Do not use* your build number as `sonar.projectVersion`.                 |

#### Authentication <a href="#authentication" id="authentication"></a>

By default, user authentication is required to prevent anonymous users from browsing and analyzing projects on your instance, and you need to authenticate when running analyses. Authentication is enforced in the global [security](https://docs.sonarsource.com/sonarqube-server/10.1/instance-administration/security "mention") settings.

When authentication is required or the "Anyone" pseudo-group does not have permission to perform analyses, you’ll need to supply the credentials of a user with Execute Analysis permissions for the analysis to run under.

|               |                                                                                                                                                                                                                                                                                                                                                                                 |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Key**       | **Description**                                                                                                                                                                                                                                                                                                                                                                 |
| `sonar.token` | <p>The <a data-mention href="../user-guide/user-account/overview">overview</a> of a SonarQube user with either Execute Analysis permission on the project or Global Execute Analysis permission.<br><br>As an alternative to this property, you can create the <code>SONAR\_TOKEN</code> environment variable and set the token as its value before you launch an analysis.</p> |

#### Web services <a href="#web-services" id="web-services"></a>

|                    |                                                                                                                                                                                                                                                |             |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| **Key**            | **Description**                                                                                                                                                                                                                                | **Default** |
| `sonar.ws.timeout` | Maximum time to wait for the response of a Web Service call (in seconds). Modifying this value from the default is useful only when you’re experiencing timeouts during analysis while waiting for the server to respond to Web Service calls. | 60          |

#### Project configuration <a href="#project-configuration" id="project-configuration"></a>

|                                   |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |                                                                                                                                                            |
| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Key**                           | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | **Default**                                                                                                                                                |
| `sonar.projectDescription`        | The project description.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | `<description>` for Maven projects                                                                                                                         |
| `sonar.links.homepage`            | Project home page.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | `<url>` for Maven projects                                                                                                                                 |
| `sonar.links.ci`                  | Continuous integration.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | `<ciManagement><url>` for Maven projects                                                                                                                   |
| `sonar.links.issue`               | Issue tracker.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | `<issueManagement><url>` for Maven projects                                                                                                                |
| `sonar.links.scm`                 | Project source repository.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | `<scm><url>` for Maven projects                                                                                                                            |
| `sonar.sources`                   | Comma-separated paths to directories containing main source files.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Read from build system for Maven, Gradle, MSBuild projects. Defaults to project base directory when neither `sonar.sources` nor `sonar.tests` is provided. |
| `sonar.tests`                     | Comma-separated paths to directories containing test source files.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Read from build system for Maven, Gradle, MSBuild projects. Else default to empty.                                                                         |
| `sonar.sourceEncoding`            | Encoding of the source files. Ex: `UTF-8`, `MacRoman`, `Shift_JIS`. This property can be replaced by the standard property `project.build.sourceEncoding` in Maven projects. The list of available encodings depends on your JVM.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | System encoding                                                                                                                                            |
| `sonar.externalIssuesReportPaths` | Comma-delimited list of paths to Generic Issue reports.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | <p><br></p>                                                                                                                                                |
| `sonar.sarifReportPaths`          | Comma-delimited list of paths to SARIF reports.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | <p><br></p>                                                                                                                                                |
| `sonar.projectDate`               | <p>Assign a date to the analysis. This parameter is only useful when you need to retroactively create the history of a not-analyzed-before project. The format is <code>YYYY-MM-DD</code>, for example, 2010-12-01. Since you cannot perform an analysis dated prior to the most recent one in the database, you must analyze and recreate your project history in chronological order, the oldest first.  <br></p><p><img src="https://931701944-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FguPtldYmKsIetAs13CP3%2Fuploads%2Fgit-blob-7b1e8da81920424698c86c69c8201d47c933bd72%2F53461ea24385e3549d8e20706bfa594dc6dc1709.svg?alt=media" alt="exclamation icon"></p><p>Note: You may need to adjust your housekeeping settings if you wish to create a long-running history.</p>                                                                                                                                                                                                                                   | Current date                                                                                                                                               |
| `sonar.projectBaseDir`            | <p>Use this property when you need analysis to take place in a directory other than the one from which it was launched. E.G. analysis begins from <code>jenkins/jobs/myjob/workspace</code> but the files to be analyzed are in <code>ftpdrop/cobol/project1</code>. The path may be relative or absolute. Specify not the source directory, but some parent of the source directory. The value specified here becomes the new "analysis directory", and other paths are then specified as though the analysis were starting from the specified value of <code>sonar.projectBaseDir</code>.<br><br></p><p><img src="https://931701944-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FguPtldYmKsIetAs13CP3%2Fuploads%2Fgit-blob-7b1e8da81920424698c86c69c8201d47c933bd72%2F53461ea24385e3549d8e20706bfa594dc6dc1709.svg?alt=media" alt="exclamation icon"></p><p>Note that the analysis process will need write permissions in this directory; it is where the <code>sonar.working.directory</code> will be created.</p> | <p><br></p>                                                                                                                                                |
| `sonar.working.directory`         | Set the working directory for an analysis triggered with the SonarScanner or the SonarScanner for Ant (versions greater than 2.0). This property is not compatible with the SonarScanner for MSBuild. The path must be relative, and unique for each project.  Beware: the specified folder is deleted before each analysis.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | `.scannerwork`                                                                                                                                             |
| `sonar.scm.provider`              | This property can be used to explicitly tell SonarQube which SCM you’re using on the project (in case auto-detection doesn’t work). The value of this property is always lowercase and depends on the SCM (ex. "git" if you’re using Git). Check the [scm-integration](https://docs.sonarsource.com/sonarqube-server/10.1/analyzing-source-code/scm-integration "mention") documentation for more.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | <p><br></p>                                                                                                                                                |
| `sonar.scm.forceReloadAll`        | By default, blame information is only retrieved for changed files. Set this property to `true` to load blame information for all files. This can be useful if you feel that some SCM data is outdated but SonarQube does not get the latest information from the SCM engine.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | <p><br></p>                                                                                                                                                |
| `sonar.scm.exclusions.disabled`   | For supported engines, files ignored by the SCM, i.e. files listed in `.gitignore`, will automatically be ignored by analysis too. Set this property to `true` to disable that feature. SCM exclusions are always disabled if `sonar.scm.disabled` is set to `true`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | <p><br></p>                                                                                                                                                |
| `sonar.scm.revision`              | Overrides the revision, for instance, the Git SHA-1, displayed in analysis results. By default value is provided by the CI environment or guessed by the checked-out sources.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | <p><br></p>                                                                                                                                                |
| `sonar.buildString`               | <p>The string passed with this property will be stored with the analysis and available in the results of <code>api/project\_analyses/search</code>, thus allowing you to later identify a specific analysis and obtain its ID for use with <code>api/project\_analyses/set\_baseline</code>.</p><p><br></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | <p><br></p>                                                                                                                                                |
| `sonar.analysis.[yourKey]`        | This property stub allows you to insert custom key/value pairs into the analysis context, which will also be passed forward to [webhooks](https://docs.sonarsource.com/sonarqube-server/10.1/project-administration/webhooks "mention").                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | <p><br></p>                                                                                                                                                |
| `sonar.newCode.referenceBranch`   | Sets the [defining-new-code](https://docs.sonarsource.com/sonarqube-server/10.1/project-administration/clean-as-you-code-settings/defining-new-code "mention") definition to `Reference Branch` for this analysis, overriding the configuration on the server. The `New Code` will be calculated based on the differences between the branch under analysis and the provided branch. This parameter is intended to be set in a configuration file (ex: `sonar-project.properties`), specific to a given branch.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | <p><br></p>                                                                                                                                                |
| `sonar.filesize.limit`            | Sets the limit in MB for files to be discarded from the analysis scope if the size is greater than specified.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | 20                                                                                                                                                         |

#### Duplications <a href="#duplications" id="duplications"></a>

|                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |             |
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| **Key**                               | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                     | **Default** |
| `sonar.cpd.${language}.minimumTokens` | A piece of code is considered duplicated as soon as there are at least 100 duplicated tokens in a row (override with `sonar.cpd.${language}.minimumTokens`) spread across at least 10 lines of code (override with `sonar.cpd.${language}.minimumLines`). For Java projects, a piece of code is considered duplicated when there is a series of at least 10 statements in a row, regardless of the number of tokens and lines. This threshold cannot be overridden. | 100         |
| `sonar.cpd.${language}.minimumLines`  | (see above)                                                                                                                                                                                                                                                                                                                                                                                                                                                         | 10          |

#### Analysis logging <a href="#analysis-logging" id="analysis-logging"></a>

|                                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |                                                                 |
| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| **Key**                          | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | **Default**                                                     |
| `sonar.log.level`                | Control the quantity/level of logs produced during an analysis. `DEBUG`: Display `INFO` logs + more details at `DEBUG` level. Similar to `sonar.verbose=true`. `TRACE`: Display `DEBUG` logs + the timings of all ElasticSearch queries and Web API calls executed by the SonarScanner.                                                                                                                                                                                                                                                                                                                                                                                      | INFO                                                            |
| `sonar.verbose`                  | <p>Add more detail to both client and server-side analysis logs. Activates DEBUG mode for the scanner, and adds client-side environment variables and system properties to the server-side log of analysis report processing. </p><p><img src="https://931701944-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FguPtldYmKsIetAs13CP3%2Fuploads%2Fgit-blob-7b1e8da81920424698c86c69c8201d47c933bd72%2F53461ea24385e3549d8e20706bfa594dc6dc1709.svg?alt=media" alt="exclamation icon"></p><p>NOTE: There is the potential for this setting to expose sensitive information such as passwords if they are stored as server-side environment variables.</p> | false                                                           |
| `sonar.scanner.dumpToFile`       | Outputs to the specified file the full list of properties passed to the scanner API as a means to debug analysis.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | <p><br></p>                                                     |
| `sonar.scanner.metadataFilePath` | Set the location where the scanner writes the report-task.txt file containing among other things the ceTaskId.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | <p>value of <code>sonar.working.directory</code></p><p><br></p> |
| <p><br></p>                      | <p><br></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | <p><br></p>                                                     |

#### Quality gate <a href="#quality-gate" id="quality-gate"></a>

|                             |                                                                                                                                                                                                                                                                                                                                                                    |             |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- |
| **Key**                     | **Description**                                                                                                                                                                                                                                                                                                                                                    | **Default** |
| `sonar.qualitygate.wait`    | Forces the analysis step to poll the SonarQube instance and wait for the Quality Gate status. If there are no other options, you can use this to fail a pipeline build when the Quality Gate is failing. See the [overview](https://docs.sonarsource.com/sonarqube-server/10.1/analyzing-source-code/ci-integration/overview "mention") page for more information. | <p><br></p> |
| `sonar.qualitygate.timeout` | Sets the number of seconds that the scanner should wait for a report to be processed.                                                                                                                                                                                                                                                                              | 300         |

#### Deprecated <a href="#deprecated" id="deprecated"></a>

{% hint style="info" %}
These parameters are listed for completeness, but are deprecated and should not be used in new analyses.
{% endhint %}

|                                                                                                                                                                                                                                                                                                                                                              |                       |                                                 |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------- | ----------------------------------------------- |
| **Key**                                                                                                                                                                                                                                                                                                                                                      | **Description**       | **Default**                                     |
| <p><code>sonar.links.scm\_dev</code></p><p><img src="https://931701944-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FguPtldYmKsIetAs13CP3%2Fuploads%2Fgit-blob-57c6853ce4db37e42a9b653d674be8b88792488e%2F081357f27f0fe0c58101a54a2ff5829bc84a0ab5.svg?alt=media" alt="cross icon"></p><p><strong>Deprecated since SQ 7.1</strong></p> | Developer connection. | `<scm><developerConnection>` for Maven projects |
