企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# C.88 SonarTask This task runs [SonarQube Scanner](http://www.sonarqube.org/), a tool for code analysis and *continuous inspection*. Table C.119: Attributes NameTypeDescriptionDefaultRequired`executable``String`Fully-qualified path of SonarQube Scanner executable. If executable is in *PATH* environment variable, the executable name is sufficient.n/aYes`configuration``String`Path of configuration file. The file format is that of a properties file (as used by Java), i.e. a list of key-value pairs `<key>=<value>`.n/aNo`errors``String`Sets errors flag of SonarQube Scanner. Allowed values are "`true`", "`false`", "`yes`", "`no`", "`1`", and "`0`".`false`No`debug``String`Sets debug flag of SonarQube Scanner. Allowed values are "`true`", "`false`", "`yes`", "`no`", "`1`", and "`0`".`false`No C.88.1 Examples C.88.1.1 Minimal Example This example assumes that the SonarQube Scanner is called *sonarqube-scanner* and is available on the *PATH*. ``` <?xml version="1.0" encoding="UTF-8"?> <project name="sonar-minimal-example" default="sonar"> <taskdef name="sonar" classname="phing.tasks.ext.sonar.SonarTask" /> <sonar executable="sonarqube-scanner"> <property name="sonar.projectKey" value="my-unique-project-key" /> <property name="sonar.projectName" value="Foo Project" /> <property name="sonar.projectVersion" value="0.1.0" /> <property name="sonar.sources" value="src" /> </sonar> </project> ``` C.88.1.2 Full Example This example consists of two files – *build.xml* and *sonar-project.properties*. The *build.xml*: ``` <?xml version="1.0" encoding="UTF-8"?> <project name="sonar-full-example" default="sonar"> <taskdef name="sonar" classname="phing.tasks.ext.sonar.SonarTask" /> <sonar executable="path/to/sonarqube-scanner" errors="true" debug="true" configuration="path/to/sonar-project.properties" > <!-- Assume that mandatory SonarQube parameters are defined in configuration file! --> <property name="sonar.log.level" value="DEBUG" /> </sonar> </project> ``` The configuration file *path/to/sonar-project.properties*: ``` sonar.projectKey = my-unique-project-key sonar.projectName = Foo Project sonar.projectVersion = 0.1.0 sonar.sources = src ``` C.88.2 Supported Nested Tags - `property` Analysis parameters of SonarQube Scanner can be defined in a configuration file or via nested `property` elements. If both a configuration file and property elements are provided, the properties are merged. Values from `property` elements overwrite values from the configuration file if their property keys are equal. Table C.120: Attributes NameTypeDescriptionDefaultRequired`name``String`Name of property.n/aYes`value``String`Value of property.n/aYes