Package org.sonarqube.gradle
Class SonarProperties
java.lang.Object
org.sonarqube.gradle.SonarProperties
A mutable wrapper for user-facing SonarQube property configuration in Gradle build scripts.
This class is part of the public API and is used during the Gradle configuration phase
to allow users to configure SonarQube analysis properties via the sonarqube { } DSL block.
The wrapped properties map is pre-populated with defaults computed from the Gradle project model,
and can be further manipulated by users through the convenience methods provided.
Usage Example:
sonarqube {
properties {
property "sonar.projectKey", "my-project"
properties([
"sonar.sources": "src",
"sonar.tests": "test"
])
}
}
Property Value Conversion: Before passing properties to the Scanner, values are converted to Strings as follows:
Iterables are recursively converted and joined into a comma-separated String- All other values are converted to Strings by calling their
toString()method
Note: This class is used for configuration, not for transferring resolved dependency information.
For that purpose, see ProjectProperties.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidproperties(Map<String, ?> properties) Convenience method for setting multiple properties.voidConvenience method for setting a single property.
-
Constructor Details
-
SonarProperties
-
-
Method Details
-
property
Convenience method for setting a single property.- Parameters:
key- the key of the property to be addedvalue- the value of the property to be added
-
properties
Convenience method for setting multiple properties.- Parameters:
properties- the properties to be added
-
getProperties
- Returns:
- The Sonar properties for the current Gradle project that are to be passed to the Sonar gradle.
-