The Sonargraph-Build Gradle plugin makes it easy to check the quality of your projects. The plugin is able to automatically download and install Sonargraph-Build if your build server has Internet connectivity. You can make the build fail depending on issues detected by Sonargraph-Build.
There are different Gradle "tasks" available for which parameters can be defined in Gradle "extensions":
-
sonargraphReport: Creates a report for an existing system.
-
sonargraphDynamicReport: Creates a system on-the-fly and creates a report for it. This is currently only available for Java systems.
-
resendFailedUploads: Attempts to re-send reports that failed to upload to Sonargraph-Enterprise.
-
sonargraphCreateOrUpdateSystem: Create a Sonargraph system out of a Gradle project.
Prerequisites:
-
You need at least Gradle 6.0 installed.
-
The plugin requires at least a Java 11 runtime.
TIP
To enforce certain rules, specify a failSet that lets the build fail based on detected issues. See Section 7.4.1, “Gradle FailSet Configuration”
NOTE
The attribute "logLevel" affects the logging after the Sonargraph-Build engine has been started. Setting it to "debug" and below will generate additional debug information into the XML report.
WARNING
Setting the attribute "reportType" to "standard" only generates metric values for "system" and "module" levels. "full" generates values for all element levels, but results in a significant larger report!
The splitting of the HTML report into different files is controlled by the attribute "elementCountToSplitHtmlReport". The resulting detail pages contain tables of issues / resolutions of a specific issue type. The maximum number of items shown is limited by the parameter "maxElementCountForHtmlDetailsPage".
WARNING
The attribute "qualityModelFile" can be used to apply a fixed set of scripts, architecture files and analyzer configurations across several systems.
The reported issues are most likely very different from the results of analyzing the system with the Sonargraph application. If you specify a "qualityModelFile", it is advisable to specify the "Parser" virtual model, since resolutions e.g. for architecture violations probably will not match.
The following table lists all parameters that are available to create a report for an existing Sonargraph system. The build can be marked as failed based on a failSet. See Section 7.4.1, “Gradle FailSet Configuration”.
Attribute | Mandatory | Description | Default |
---|---|---|---|
sonargraphBuildVersion | No | Allows you to use a specific or restricted version of Sonargraph-Build. Can be used in combination with 'autoUpdate'. As an example, if you specify '8.7' the newest available version starting with '8.7' will be used. If you specify '8.7.0.361' you are locked on that specific version of Sonargraph-Build. There are two special values: "same" and "newest". If "same" is defined the version of Sonargraph-Build must be the same as the version of the Maven plugin. If "newest" is defined the plugin will always try to use the newest version of Sonargraph-Build. | same |
skip | No | Skip Sonargraph-Build. | false |
autoUpdate | No | If the plugin is configured to download Sonargraph-Build automatically, this parameter decides if it also should be updated automatically if a new version becomes available. | false |
useHttpProxyHost | No | If true, the proxy configuration of the Gradle settings is used. The plugin will use this proxy for all HTTP communication. Check the Gradle online documentation for details. | false |
repository | No | URL of Json file containing information about available Sonargraph Build versions with their download locations. | |
installationDirectory | No | Installation directory of Sonargraph-Build. If unspecified the plugin will automatically download Sonargraph-Build. The version to be downloaded can be controlled by the parameter 'sonargraphBuildVersion'. | No default |
activationCode | No | Sonargraph license activation code. If this parameter is not specified, you must specify a license file parameter (see below). | No default |
waitForLicense |
No | If license is ticket based, this parameter specifies the number of minutes that will be waited for a license to become available if all license tickets are currently in use. Waiting period between tries is 60 seconds. Possible values are: -1 (infinitely), 0 (do not wait), positive number > 0 | -1 |
licenseServerUrl | No | URL of license server to be used. Must start with 'http:' or 'https:'. | |
licenseFile | No | Sonargraph license file location. If this parameter is not specified, you must specify the activation code parameter (see above). | No default |
languages | No | The languages that should be initialized, separated by ",". The fewer languages are specified the faster the startup of Sonargraph-Build. Possible values: Java, CSharp, CPlusPlus. | Java |
logFile | No | Path of the log file to be used for Sonargraph-Build. | ${project.buildDir}/sonargraph_build.log |
logLevel | No | Level of logging detail. One of: off, error, warn, info, debug, trace, all | info |
progressInfo | No | Level of progress info, either "none", "basic" or "detailed". "detailed" expects that the output console supports backspace characters. | none |
analyzerExecutionLevel | No | Controls which analyzers will run after the parser has finished. Consider lower levels if your build takes too much time. Allowed values are FULL, ADVANCED, BASIC and MINIMAL. | FULL |
compilerDefinitionPath | No |
The path to the active compiler definition file to be used for parsing a C/C++ system. If a built-in or automatically generated definition should be used, prefix the definition with "CPlusPlus:", e.g. CPlusPlus:GnuCpp.cdef. NOTE: If the standalone Sonargraph application is used on the same machine with the same user and this parameter is empty, the active definition specified with the standalone application will be used. |
If empty, the default compiler definition for the build server's operating system is used: GnuCpp.cdef (Linux), CLang.cdef (Mac), VisualCpp*.cdef (Windows, generated definition for the latest Visual Studio installation) |
numberOfDaemons | No |
The number of C/C++ parser daemon processes - minimum is 1, maximum is 16. |
8 |
daemonStackSize | No |
Stack size for C/C++ parser daemons in MB. |
1 |
requiredInstallationProfiles | No | Comma separated list of C# installation profiles (e.g. 'net-5.0') that will be created by Sonargraph before the actual build. The names are the id's of the profiles as shown in the c# preferences dialog. | |
systemDirectory | No | Directory of the Sonargraph System (xyz.sonargraph) | ${project.buildDir}/${project.group}.sonargraph |
overrideSonargraphWorkspace | No | If true the output directories defined in the Sonargraph system will be overridden by the ones provided by the client. | true |
includeTestCode | No | If true the workspace will also contain the test source and test class file directories. | false |
includeEmptyModules | No | If true the workspace will also contain empty modules (without any source and class file directories). | false |
productionSourceSets | No | Comma separated list of source set names that contain production code. This parameter is only needed when you are not using the gradle default "main". | main |
testSourceSets | No | Comma separated list of source set names that contain test code. This parameter is only needed when you are not using the gradle default "test". | test |
virtualModel | No | The virtual model to be used when checking for issues. This parameter overrides the default virtual model that is set when the system is opened. The default virtual model is "Modifiable.vm", if virtual models are licensed, "Parser" if not licensed. Parameter can only be used with Sonargraph-Architect license. | No default |
qualityModelFile | No | The path to the quality model file (xyz.sgqm) that should be applied for the report creation. Built-in quality models are the language-independent "Sonargraph:Default.sgqm" and language-specific "Sonargraph:Java.sgqm", "Sonargraph:CSharp.sgqm" and "Sonargraph:CPlusPlus.sgqm". NOTE: All scripts, analyzer configurations and architecture files present in the system are ignored! | No default |
snapshotDirectory | No | Target directory for the created snapshot. Only if either this parameter or snapshotFileName is provided, a snapshot will be generated. Parameter can only be used with Sonargraph-Architect license. | ${project.buildDir} |
snapshotFileName | No | The target file name (without extension). Only if either this parameter or snapshotDirectory is provided, a snapshot will be generated. Parameter can only be used with Sonargraph-Architect license. | <system-name>_<timestamp> |
reportDirectory | No | Target directory for the created report | ${project.buildDir}/sonargraph |
reportFileName | No | The target file name (without extension) | <system-name>_<timestamp> |
reportType | No | "standard" only creates metric information of system and module level. "full" creates metric information of all levels. | standard |
reportFormat | No | "xml", "html" or "xml, html" | html |
contextInfo | No | Allows specifying some additional info that helps to identify later the context of the report creation. | Current timestamp |
elementCountToSplit |
No | Issue and resolution tables might contain too many items making it impossible to open the HTML report in a browser. This parameter controls the lower limit of items that will cause separate files being generated per issue type. Possible values are: -1 (never split), 0 (use default value), 1 (always split), positive number > 1 (threshold for split) | 1000 |
maxElementCountFor |
No | If HTML report is split because of too many issues and/or resolutions, detail tables might contain too many items making it impossible to open the page in a browser. This parameter controls the upper limit of elements shown in the table. Possible values are: -1 (no limit), 0 (use default limit), positive number > 1 (maximum number of elements contained in page) | 2000 |
splitByModule | No | If set to 'true', individual HTML reports are created per module. | false |
baselineReportPath | No | Path of the baseline XML report that the current report is compared against. If specified, the system diff report is generated into the reportDirectory and has the filename <reportFileName>_diff. If no reportFileName is specified, the diff report's filename is <system-name>_diff_<timestamp>. | No default |
prepareForSonarQube | No | Creates an XML report and stores it at ${basedir}/${target}/sonargraph/sonargraph-sonarqube-report.xml, where the SonarQube Sonargraph plugin expects it. | false |
pythonInterpreterPath | No |
The path to a valid Python 3 interpreter to be used for the build. NOTE: If the standalone Sonargraph application is used on the same machine with the same user and this parameter is empty, the Python interpreter specified with the standalone application will be used. |
PATH is searched for a valid Python 3 interpreter. If none can be found in this parameter is not set the build will fail. |
uploadHostUrl | No | The host and port of the Sonargraph-Enterprise server (upcoming product). If this parameter is defined Sonargraph-Build will upload the report to this server. If the upload fails for some reason the report will be copied to a configurable directory (see parameter 'failedUploadDirectory') that collects all failed uploads. This directory is used by another task named 'resendFailedUploads' that should be invoked on a regular base. It is assumed that the server is internal, so as of now proxy settings are ignored. Must start with "http://". | No default |
createAndUploadSnapshot | No | If the parameter 'uploadHostUrl' is set, Sonargraph will also create a snapshot of your system and upload it to Sonargraph-Enterprise. Set this parameter to 'false' if you don't want to create and upload snapshots. | true |
clientKey | Only if 'uploadHostUrl' is set | The client key for the Sonargraph-Enterprise server. Uploading reports only works with the right client key, which can be found on the settings page of Sonargaph-Enterprise. The settings page is only visible in administrator mode. | No default |
failedUploadDirectory | No | If the upload to the server configured in the parameter 'uploadHostUrl' fails for some reason the report that failed to upload is copied to this directory for later pickup by the task 'resendFailedUploads'. If you have a distributed build that directory should ideally point to a shared network storage drive. | System specific in user home directory |
branch | No | If reports are uploaded to the Sonargraph-Enterprise server (upcoming product, see parameter 'uploadHostUrl') it is useful to associate the report with the version control system branch name to avoid mixing data of different branches. If the branch name is not given we assume 'default'. If you are only uploading data of the same branch you do not need to pass the branch name, otherwise it is highly recommended. | default |
commitId | No | This parameter is only used in conjunction with 'uploadHostUrl' and should be used if the uploaded report should be associated with a specific version control commit id. | No default |
version | No | This parameter is only used in conjunction with 'uploadHostUrl' and should be used if the uploaded report should be associated with a specific software version. If you are using git flow, you would want to use this parameter for every commit of the master branch, since each commit is associated with a software release. | No default |
timestamp | No | This parameter allows to specify the timestamp in ISO-8601 extended offset date-time format, e.g. '2011-12-03T10:15:30+01:00'. | Current timestamp |
Related topics:
The following table lists all parameters that are available to create a report for a Java or TypeScript project where no Sonargraph system has been defined. A Sonargraph system is created on the fly based on the workspace information contained in the Gradle project setup. The build can be marked as failed based on a failSet. See Section 7.4.1, “Gradle FailSet Configuration”.
Attribute | Mandatory | Description | Default |
---|---|---|---|
sonargraphBuildVersion | No | Allows you to use a specific or restricted version of Sonargraph-Build. Can be used in combination with 'autoUpdate'. As an example, if you specify '8.7' the newest available version starting with '8.7' will be used. If you specify '8.7.0.361' you are locked on that specific version of Sonargraph-Build. There are two special values: "same" and "newest". If "same" is defined the version of Sonargraph-Build must be the same as the version of the Maven plugin. If "newest" is defined the plugin will always try to use the newest version of Sonargraph-Build. | same |
skip | No | Skip Sonargraph-Build. | false |
autoUpdate | No | If the plugin is configured to download Sonargraph-Build automatically, this parameter decides if it also should be updated automatically if a new version becomes available. | false |
useHttpProxyHost | No | If true, the proxy configuration of the Gradle settings is used. The plugin will use this proxy for all HTTP communication. Check the Gradle online documentation for details. | false |
tsConfigPath | No | Relative path to tsconfig.json. If set onargraph-Build will create a report for the associated TypeScript system. | |
pythonRoot | No | Relative path to Python source root directory. If set Sonargraph-Build will create a report for the associated Python system. | |
pythonVirtualEnvironment | No | Relative path to the virtual environment of this Python project. | |
repository | No | URL of Json file containing information about available Sonargraph Build versions with their download locations. | |
installationDirectory | No | Installation directory of Sonargraph-Build. If unspecified the plugin will automatically download Sonargraph-Build. The version to be downloaded can be controlled by the parameter 'sonargraphBuildVersion'. | No default |
activationCode | No | Sonargraph license activation code. If this parameter is not specified, you must specify a license file parameter (see below). | No default |
waitForLicense |
No | If license is ticket based, this parameter specifies the number of minutes that will be waited for a license to become available if all license tickets are currently in use. Waiting period between tries is 60 seconds. Possible values are: -1 (infinitely), 0 (do not wait), positive number > 0 | -1 |
licenseServerUrl | No | URL of license server to be used. Must start with 'http:' or 'https:'. | |
licenseFile | No | Sonargraph license file location. If this parameter is not specified, you must specify the activation code parameter (see above). | No default |
languages | No | The languages that should be initialized, separated by ",". The fewer languages are specified the faster the startup of Sonargraph-Build. Possible values: Java, CSharp, CPlusPlus. | Java |
logFile | No | Path of the log file to be used for Sonargraph-Build. | ${project.buildDir}/sonargraph_build.log |
logLevel | No | Level of logging detail. One of: off, error, warn, info, debug, trace, all | info |
progressInfo | No | Level of progress info, either "none", "basic" or "detailed". "detailed" expects that the output console supports backspace characters. | none |
analyzerExecutionLevel | No | Controls which analyzers will run after the parser has finished. Consider lower levels if your build takes too much time. Allowed values are FULL, ADVANCED, BASIC and MINIMAL. | FULL |
systemBaseDirectory | No | The directory where the Sonargraph System (${artifactId}.sonargraph) is created. | ${project.buildDir} |
systemId | No | A system id should stay constant over the lifetime of a software system and should be also unique with respect to other systems. If you anticipate that the group id or artifact id of the root pom might change you should assign a value to this parameter. | ${project.group}_${project.name} |
useGroupIdInModuleName | No | If true the module names will use group id and artifact id as their name, separated by an underscore. By default only the artifact id is used as the module name. | false |
includeTestCode | No | If true the workspace will also contain the test source and test class file directories. | false |
includeEmptyModules | No | If true the workspace will also contain empty modules (without any source and class file directories). | false |
productionSourceSets | No | Comma separated list of source set names that contain production code. This parameter is only needed when you are not using the gradle default "main". | main |
testSourceSets | No | Comma separated list of source set names that contain test code. This parameter is only needed when you are not using the gradle default "test". | test |
virtualModel | No | The virtual model to be used when checking for issues. This parameter overrides the default virtual model that is set when the system is opened. The default virtual model is "Modifiable.vm", if virtual models are licensed, "Parser" if not licensed. Parameter can only be used with Sonargraph-Architect license. | No default |
qualityModelFile | No | The path to the quality model file (xyz.sgqm) that should be applied for the report creation. Built-in quality models are the language-independent "Sonargraph:Default.sgqm" and language-specific "Sonargraph:Java.sgqm", "Sonargraph:CSharp.sgqm" and "Sonargraph:CPlusPlus.sgqm". NOTE: All scripts, analyzer configurations and architecture files present in the system are ignored! | No default |
snapshotDirectory | No | Target directory for the created snapshot. Only if either this parameter or snapshotFileName is provided, a snapshot will be generated. Parameter can only be used with Sonargraph-Architect license. | ${project.buildDir} |
snapshotFileName | No | The target file name (without extension). Only if either this parameter or snapshotDirectory is provided, a snapshot will be generated. Parameter can only be used with Sonargraph-Architect license. | <system-name>_<timestamp> |
reportDirectory | No | Target directory for the created report | ${project.buildDir}/sonargraph |
reportFileName | No | The target file name (without extension) | <system-name>_<timestamp> |
reportType | No | "standard" only creates metric information of system and module level. "full" creates metric information of all levels. | standard |
reportFormat | No | "xml", "html" or "xml, html" | html |
contextInfo | No | Allows specifying some additional info that helps to identify later the context of the report creation. | Current timestamp |
splitByModule | No | If set to 'true', individual HTML reports are created per module. | false |
elementCountToSplit |
No | Issue and resolution tables might contain too many items making it impossible to open the HTML report in a browser. This parameter controls the lower limit of items that will cause separate files being generated per issue type. Possible values are: -1 (never split), 0 (use default value), 1 (always split), positive number > 1 (threshold for split) | 1000 |
maxElementCountFor |
No | If HTML report is split because of too many issues and/or resolutions, detail tables might contain too many items making it impossible to open the page in a browser. This parameter controls the upper limit of elements shown in the table. Possible values are: -1 (no limit), 0 (use default limit), positive number > 1 (maximum number of elements contained in page) | 2000 |
baselineReportPath | No | Path of the baseline XML report that the current report is compared against. If specified, the system diff report is generated into the reportDirectory and has the filename <reportFileName>_diff. If no reportFileName is specified, the diff report's filename is <system-name>_diff_<timestamp>. | No default |
prepareForSonarQube | No | Creates an XML report and stores it at ${basedir}/${target}/sonargraph/sonargraph-sonarqube-report.xml, where the SonarQube Sonargraph plugin expects it. | false |
uploadHostUrl | No | The host and port of the Sonargraph-Enterprise server (upcoming product). If this parameter is defined Sonargraph-Build will upload the report to this server. If the upload fails for some reason the report will be copied to a configurable directory (see parameter 'failedUploadDirectory') that collects all failed uploads. This directory is used by another task named 'resendFailedUploads' that should be invoked on a regular base. It is assumed that the server is internal, so as of now proxy settings are ignored. Must start with "http://". | No default |
createAndUploadSnapshot | No | If the parameter 'uploadHostUrl' is set, Sonargraph will also create a snapshot of your system and upload it to Sonargraph-Enterprise. Set this parameter to 'false' if you don't want to create and upload snapshots. | true |
clientKey | Only if 'uploadHostUrl' is set | The client key for the Sonargraph-Enterprise server. Uploading reports only works with the right client key, which can be found on the settings page of Sonargaph-Enterprise. The settings page is only visible in administrator mode. | No default |
failedUploadDirectory | No | If the upload to the server configured in the parameter 'uploadHostUrl' fails for some reason the report that failed to upload is copied to this directory for later pickup by the task 'resendFailedUploads'. If you have a distributed build that directory should ideally point to a shared network storage drive. | System specific in user home directory |
branch | No | If reports are uploaded to the Sonargraph-Enterprise server (upcoming product, see parameter 'uploadHostUrl') it is useful to associate the report with the version control system branch name to avoid mixing data of different branches. If the branch name is not given we assume 'default'. If you are only uploading data of the same branch you do not need to pass the branch name, otherwise it is highly recommended. | default |
commitId | No | This parameter is only used in conjunction with 'uploadHostUrl' and should be used if the uploaded report should be associated with a specific version control commit id. | No default |
version | No | This parameter is only used in conjunction with 'uploadHostUrl' and should be used if the uploaded report should be associated with a specific software version. If you are using git flow, you would want to use this parameter for every commit of the master branch, since each commit is associated with a software release. | No default |
timestamp | No | This parameter allows to specify the timestamp in ISO-8601 extended offset date-time format, e.g. '2011-12-03T10:15:30+01:00'. | Current timestamp |
Related topics:
Sonargraph-Build can mark the build as failed based on detected issues.
The following elements allow to mark a build as failed. An example is shown in the next section Section 7.5, “Example Gradle Build File”.
TIP
Support for quality gates has been introduced with Sonargraph version 10.3, making it easier to define conditions for breaking the build: Simply define the quality gates in Sonargraph, activate them and define a failSet for the issue type "QualityGateIssue". For more details on quality gates, check the user manual of Sonargraph Architect.
Please note, that a commercial license is required for the quality gate feature.
TIP
The issue type that must be specified for include/exclude definitions can be determined via the Properties View of Sonargraph.
TIP
If you want the build to fail only for newly introduced issues, apply resolutions like "Ignore" or "Fix" to the already known issues in Sonargraph and only filter for resolution value "none".
TIP
The include/exclude definitions are applied in the following sequence, regardless of their definition order:
-
First all include definitions are matched against the set of existing issues.
-
Then the exclude definitions are applied and the set of previously matched issues is reduced accordingly.
Element | Parameter | Mandatory | Description | Default |
---|---|---|---|---|
failSet | failOnEmptyWorkspace | No | Marks the build as failed if modules and root directories are detected but no components are found. Possible values are "true" or "false". | true |
failSet | failOnIssues | No | Marks the build as failed if issues exist. Possible values are "true" or "false". | true |
include/exclude | issueType | Yes | Name of the issue type or "any" for wildcard matching. | No default |
include/exclude | severity | No | Severity of the issue. Possible values are: error, warning, info, none, any | any |
include/exclude | resolution | No | The issue's resolution type. Possible values are: task, ignore, any, none | none |
The following examples shows how to integrate the Sonargraph-Build Gradle plugin into your project. For multi-project builds it is sufficient to only add the plugin to the root project. It runs as an aggregator after all modules have been compiled. The example project in the installation contains a complete build.gradle file. Typically you would run the plugin with a command-line like the following to ensure that everything is compiled from scratch before the report is created:
gradlew clean build sonargraphReport
FailSet Configuration
The following shows the relevant section of a build.gradle file that demonstrates the configuration of the failSet functionality. The file is contained as part of the example project in the Sonargraph-Build installation.
In this example the build will fail if the project contains a package cycle or an architecture violation without a resolution. Since the parameter 'installationDirectory' is not defined, the Gradle plugin will automatically download the newest release of Sonargraph-Build and also will keep it updated automatically. Of course this requires that the build server has access to the Internet.
plugins { id "com.hello2morrow.sonargraph" version "12.0.0" } sonargraph { activationCode = "36E2-0F3E-643F-B4F2" qualityModelFile = "Sonargraph:Java.sgqm" // quality model used by task 'sonargraphDynamicReport' failSet { failOnEmptyWorkspace = true include(issueType: "any", severity: "error", resolution: "none") include(issueType: "ArchitectureViolation") include(issueType: "any", severity: "warning") exclude(issueType: "ThresholdViolation") } }
NOTE
Boolean and numeric parameters must be set without any quotes.
NOTE
Variable substitution in parameters does not work with single quotes, use double quotes instead.
Here are all the parameters for the "resendFailedUploads" task. This task should be run at least once per day to retry sending failed uploads to the Sonargraph-Enterprise server.
Attribute | Mandatory | Description | Default |
---|---|---|---|
sonargraphBuildVersion | No | Allows you to use a specific or restricted version of Sonargraph-Build. Can be used in combination with 'autoUpdate'. As an example, if you specify '8.7' the newest available version starting with '8.7' will be used. If you specify '8.7.0.361' you are locked on that specific version of Sonargraph-Build. There are two special values: "same" and "newest". If "same" is defined the version of Sonargraph-Build must be the same as the version of the Maven plugin. If "newest" is defined the plugin will always try to use the newest version of Sonargraph-Build. | same |
skip | No | Skip Sonargraph-Build. | false |
autoUpdate | No | If the plugin is configured to download Sonargraph-Build automatically, this parameter decides if it also should be updated automatically if a new version becomes available. | false |
useHttpProxyHost | No | If true, the proxy configuration of the Gradle settings is used. The plugin will use this proxy for all HTTP communication. Check the Gradle online documentation for details. | false |
repository | No | URL of Json file containing information about available Sonargraph Build versions with their download locations. | |
installationDirectory | No | Installation directory of Sonargraph-Build. If unspecified the plugin will automatically download Sonargraph-Build. The version to be downloaded can be controlled by the parameter 'sonargraphBuildVersion'. | No default |
activationCode | No | Sonargraph license activation code. If this parameter is not specified, you must specify a license file parameter (see below). | No default |
waitForLicense |
No | If license is ticket based, this parameter specifies the number of minutes that will be waited for a license to become available if all license tickets are currently in use. Waiting period between tries is 60 seconds. Possible values are: -1 (infinitely), 0 (do not wait), positive number > 0 | -1 |
licenseServerUrl | No | URL of license server to be used. Must start with 'http:' or 'https:'. | |
licenseFile | No | Sonargraph license file location. If this parameter is not specified, you must specify the activation code parameter (see above). | No default |
languages | No | The languages that should be initialized, separated by ",". The fewer languages are specified the faster the startup of Sonargraph-Build. Possible values: Java, CSharp, CPlusPlus. | Java |
logFile | No | Path of the log file to be used for Sonargraph-Build. | ${project.buildDir}/sonargraph_build.log |
logLevel | No | Level of logging detail. One of: off, error, warn, info, debug, trace, all | info |
progressInfo | No | Level of progress info, either "none", "basic" or "detailed". "detailed" expects that the output console supports backspace characters. | none |
uploadHostUrl | Yes | The host and port of the Sonargraph-Enterprise server (upcoming product). If this parameter is defined Sonargraph-Build will upload the report to this server. If the upload fails for some reason the report will be copied to a configurable directory (see parameter 'failedUploadDirectory') that collects all failed uploads. This directory is used by another task named 'resendFailedUploads' that should be invoked on a regular base. It is assumed that the server is internal, so as of now proxy settings are ignored. Must start with "http://". | No default |
clientKey | Yes | The client key for the Sonargraph-Enterprise server. Uploading reports only works with the right client key, which can be found on the settings page of Sonargaph-Enterprise. The settings page is only visible in administrator mode. | No default |
failedUploadDirectory | No | If the upload to the server configured in the parameter 'uploadHostUrl' fails for some reason the report that failed to upload is copied to this directory for later pickup by the task 'resendFailedUploads'. If you have a distributed build that directory should ideally point to a shared network storage drive. | System specific in user home directory |
Related topics:
Here are the parameters for the 'sonargraphCreateOrUpdateSystem' task. Please note that this task does not require a license.
Attribute | Mandatory | Description | Default |
---|---|---|---|
sonargraphBuildVersion | No | Allows you to use a specific or restricted version of Sonargraph-Build. Can be used in combination with 'autoUpdate'. As an example, if you specify '8.7' the newest available version starting with '8.7' will be used. If you specify '8.7.0.361' you are locked on that specific version of Sonargraph-Build. There are two special values: "same" and "newest". If "same" is defined the version of Sonargraph-Build must be the same as the version of the Maven plugin. If "newest" is defined the plugin will always try to use the newest version of Sonargraph-Build. | same |
skip | No | Skip Sonargraph-Build. | false |
autoUpdate | No | If the plugin is configured to download Sonargraph-Build automatically, this parameter decides if it also should be updated automatically if a new version becomes available. | false |
installationDirectory | No | Installation directory of Sonargraph-Build. If unspecified the plugin will automatically download Sonargraph-Build. The version to be downloaded can be controlled by the parameter 'sonargraphBuildVersion'. | No default |
logFile | No | Path of the log file to be used for Sonargraph-Build. | ${project.buildDir}/sonargraph_build.log |
logLevel | No | Level of logging detail. One of: off, error, warn, info, debug, trace, all | info |
systemBaseDirectory | No | The directory where the Sonargraph System (${artifactId}.sonargraph) is created. | ${project.dir} |
systemId | No | A system id should stay constant over the lifetime of a software system and should be also unique with respect to other systems. If you anticipate that the group id or artifact id of the root pom might change you should assign a value to this parameter. | ${project.group}_${project.name} |
systemName | No | The name of the Sonargraph directory to be generated. | ${project.group}_${project.name} |
useGroupIdInModuleName | No | If true the module names will use group id and artifact id as their name, separated by an underscore. By default only the artifact id is used as the module name. | false |
includeTestCode | No | If true the workspace will also contain the test source and test class file directories. | false |
includeEmptyModules | No | If true the workspace will also contain empty modules (without any source and class file directories). | false |
productionSourceSets | No | Comma separated list of source set names that contain production code. This parameter is only needed when you are not using the gradle default "main". | main |
testSourceSets | No | Comma separated list of source set names that contain test code. This parameter is only needed when you are not using the gradle default "test". | test |
qualityModelFile | No | The path to the quality model file (xyz.sgqm) that should be applied for the report creation. Built-in quality models are the language-independent "Sonargraph:Default.sgqm" and language-specific "Sonargraph:Java.sgqm", "Sonargraph:CSharp.sgqm" and "Sonargraph:CPlusPlus.sgqm". NOTE: All scripts, analyzer configurations and architecture files present in the system are ignored! | No default |