Uredi

Deli z drugimi prek


SonarQubePrepare@4 - Prepare Analysis Configuration v4 task

Use this task to prepare a SonarQube analysis configuration.

Note

This task is deprecated; use SonarQubePrepare@6.

Syntax

# Prepare Analysis Configuration v4
# Prepare SonarQube analysis configuration.
- task: SonarQubePrepare@4
  inputs:
    SonarQube: # string. Required. SonarQube Server Endpoint. 
    scannerMode: 'MSBuild' # 'MSBuild' | 'Other' | 'CLI'. Required. Choose the way to run the analysis. Default: MSBuild.
    #configMode: 'file' # 'file' | 'manual'. Required when scannerMode = CLI. Mode. Default: file.
    #configFile: 'sonar-project.properties' # string. Optional. Use when scannerMode = CLI && configMode = file. Settings File. Default: sonar-project.properties.
    #cliProjectKey: # string. Required when scannerMode = CLI && configMode = manual. Project Key. 
    projectKey: # string. Required when scannerMode = MSBuild. Project Key. 
    #cliProjectName: # string. Optional. Use when scannerMode = CLI && configMode = manual. Project Name. 
    #projectName: # string. Optional. Use when scannerMode = MSBuild. Project Name. 
    #cliProjectVersion: '1.0' # string. Optional. Use when scannerMode = CLI && configMode = manual. Project Version. Default: 1.0.
    #projectVersion: '1.0' # string. Optional. Use when scannerMode = MSBuild. Project Version. Default: 1.0.
    #cliSources: '.' # string. Required when scannerMode = CLI && configMode = manual. Sources directory root. Default: ..
  # Advanced
    #extraProperties: # string. Additional Properties.

Inputs

SonarQube - SonarQube Server Endpoint
string. Required.

Specifies the SonarQube server endpoint for your project. To create one, click the Manage link, create a new SonarQube Server Endpoint, and enter your server url and token.


scannerMode - Choose the way to run the analysis
string. Required. Allowed values: MSBuild (Integrate with MSBuild), Other (Integrate with Maven or Gradle), CLI (Use standalone scanner). Default value: MSBuild.

MSBuild

  • Put this task before your MSBuild task.
  • Add the Run Code Analysis task after the MSBuild/VSTest tasks.

Maven/Gradle

  • Put this task before the Maven/Gradle task.
  • Tick the Run SonarQube Analysis checkbox in the Maven/Gradle task configuration.

Others

  • For other cases, you can use the standalone scanner (sonar-scanner), set all configurations with this task, and then add the Run Code Analysis task.

configMode - Mode
string. Required when scannerMode = CLI. Allowed values: file (Store configuration with my source code (sonar-project.properties)), manual (Manually provide configuration). Default value: file.

Specifies your preferred configuration method.


configFile - Settings File
string. Optional. Use when scannerMode = CLI && configMode = file. Default value: sonar-project.properties.

Specifies the configuration settings and project properties. Learn more about the SonarQube Extension for Azure DevOps.


cliProjectKey - Project Key
string. Required when scannerMode = CLI && configMode = manual.

Specifies the SonarQube project unique key. For example, sonar.projectKey.


projectKey - Project Key
string. Required when scannerMode = MSBuild.

Specifies the SonarQube project unique key. For example, sonar.projectKey.


cliProjectName - Project Name
string. Optional. Use when scannerMode = CLI && configMode = manual.

Specifies the SonarQube project name. For example, sonar.projectName.


projectName - Project Name
string. Optional. Use when scannerMode = MSBuild.

Specifies the SonarQube project name. For example, sonar.projectName.


cliProjectVersion - Project Version
string. Optional. Use when scannerMode = CLI && configMode = manual. Default value: 1.0.

Specifies the SonarQube project version. For example, sonar.projectVersion.


projectVersion - Project Version
string. Optional. Use when scannerMode = MSBuild. Default value: 1.0.

Specifies the SonarQube project version. For example, sonar.projectVersion.


cliSources - Sources directory root
string. Required when scannerMode = CLI && configMode = manual. Default value: ..

Specifies the path to the root directory containing source files. This value is set to the sonar.sources SonarQube property.


extraProperties - Additional Properties
string. Default value: # Additional properties that will be passed to the scanner, \n# Put one key=value per line, example:\n# sonar.exclusions=**/*.bin.

Specifies additional properties to be passed to the scanner. Specify each key=value pair on a new line.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Remarks

Note

This task is deprecated; use SonarQubePrepare@6.

  • Support non-MSBuild projects: This task can also configure analysis for non-MSBuild projects.

Requirements

Requirement Description
Pipeline types YAML, Classic build
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 2.144.0 or greater
Task category Build

See also