Sonar

API Documentation:Sonar

Analyzes a project and stores the results in Sonar's database.

Properties

PropertyDescription
bootstrapDir

The directory to be used for caching files downloaded from the Sonar server.

projectClassesDirs

The directories containing the class files of the project to be analyzed.

projectDependencies

The dependencies of the project to be analyzed. Typically these will be Jar files.

projectDescription

The description of the project to be analyzed.

projectDir

The base directory for the project to be analyzed.

projectKey

A unique key for identifying the project to be analyzed.

projectMainSourceDirs

The directories containing the production sources of the project to be analyzed.

projectName

The name of the project to be analyzed.

projectProperties

Project-specific properties for use by the Sonar code analyzer.

projectTestSourceDirs

The directories containing the test sources of the project to be analyzed.

projectVersion

The version of the project to be analyzed.

serverUrl

The Sonar server to connect to.

Property details

File bootstrapDir

The directory to be used for caching files downloaded from the Sonar server.

Default with sonar and java plugins:
Gradle-managed per-project cache directory

Set<File> projectClassesDirs

The directories containing the class files of the project to be analyzed.

Default with sonar and java plugins:
project.sourceSets.main.classesDir

Set<File> projectDependencies

The dependencies of the project to be analyzed. Typically these will be Jar files.

Default with sonar and java plugins:
project.configurations.compile.resolve()

String projectDescription

The description of the project to be analyzed.

Default with sonar and java plugins:
project.description

File projectDir

The base directory for the project to be analyzed.

Default with sonar and java plugins:
project.projectDir

String projectKey

A unique key for identifying the project to be analyzed.

Default with sonar and java plugins:
$project.group:$project.name

Set<File> projectMainSourceDirs

The directories containing the production sources of the project to be analyzed.

Default with sonar and java plugins:
project.sourceSets.main.java.srcDirs

String projectName

The name of the project to be analyzed.

Default with sonar and java plugins:
project.name

Map projectProperties

Project-specific properties for use by the Sonar code analyzer.

Default with sonar and java plugins:
["sonar.java.source": project.sourceCompatibility, "sonar.java.target": project.targetCompatibility, "sonar.dynamicAnalysis": "reuseReports", "sonar.surefire.reportsPath": project.test.testResultsDir]

Set<File> projectTestSourceDirs

The directories containing the test sources of the project to be analyzed.

Default with sonar and java plugins:
project.sourceSets.main.java.srcDirs

String projectVersion

The version of the project to be analyzed.

Default with sonar and java plugins:
project.version

String serverUrl

The Sonar server to connect to.

Default with sonar and java plugins:
http://localhost:9000

Script blocks

No script blocks

Methods

MethodDescription
globalProperties(properties)

Adds the specified properties to the map of global properties. Existing properties with the same name will be overwritten.

globalProperty(name, value)

Adds the specified property to the map of global properties. If a property with the specified name already exists, it will be overwritten.

projectClassesDir(classesDir)

Adds the specified directory to the set of project classes directories.

projectClassesDirs(classesDirs)

Adds the specified directories to the set of project classes directories.

projectDependencies(dependencies)

Adds the specified dependencies to the set of project dependencies. Typically these will be Jar files.

projectDependency(dependency)

Adds the specified dependency to the set of project dependencies. Typically this will be a Jar file.

projectMainSourceDir(sourceDir)

Adds the specified directory to the set of project main source directories.

projectMainSourceDirs(sourceDirs)

Adds the specified directories to the set of project main source directories.

projectProperties(properties)

Adds the specified properties to the map of project properties. Existing properties with the same name will be overwritten.

projectProperty(name, value)

Adds the specified property to the map of project properties. If a property with the specified name already exists, it will be overwritten.

projectTestSourceDir(sourceDir)

Adds the specified directory to the set of project test source directories.

projectTestSourceDirs(sourceDirs)

Adds the specified directories to the set of project test source directories.

Method details

void globalProperties(Map properties)

Adds the specified properties to the map of global properties. Existing properties with the same name will be overwritten.

void globalProperty(String name, String value)

Adds the specified property to the map of global properties. If a property with the specified name already exists, it will be overwritten.

void projectClassesDir(File classesDir)

Adds the specified directory to the set of project classes directories.

void projectClassesDirs(File... classesDirs)

Adds the specified directories to the set of project classes directories.

void projectDependencies(File... dependencies)

Adds the specified dependencies to the set of project dependencies. Typically these will be Jar files.

void projectDependency(File dependency)

Adds the specified dependency to the set of project dependencies. Typically this will be a Jar file.

void projectMainSourceDir(File sourceDir)

Adds the specified directory to the set of project main source directories.

void projectMainSourceDirs(File... sourceDirs)

Adds the specified directories to the set of project main source directories.

void projectProperties(Map properties)

Adds the specified properties to the map of project properties. Existing properties with the same name will be overwritten.

void projectProperty(String name, String value)

Adds the specified property to the map of project properties. If a property with the specified name already exists, it will be overwritten.

void projectTestSourceDir(File sourceDir)

Adds the specified directory to the set of project test source directories.

void projectTestSourceDirs(File... sourceDirs)

Adds the specified directories to the set of project test source directories.