Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD

## org.gradle.api.plugins.sonar.model
[Groovy] Class SonarProject

    java.lang.Object
      org.gradle.api.plugins.sonar.model.SonarProject

    class SonarProject

Per-project configuration options.

Property Summary
`File` | `baseDir` The base directory for the analysis.
`List` | `binaryDirs` The directories containing the project's compiled code to be analyzed.
`File` | `cloverReportPath` The Clover XML report file.
`File` | `coberturaReportPath` The Cobertura XML report file.
`String` | `date` The date when analysis was performed.
`String` | `description` A description for the project.
`String` | `dynamicAnalysis` Whether and how to perform dynamic analysis.
`boolean` | `importSources` Tells whether to the project's source code should be stored and made available via the Sonar web interface.
`SonarJavaSettings` | `java` Java-related configuration options.
`String` | `key` The identifier for the project.
`String` | `language` The programming language to be analyzed.
`FileCollection` | `libraries` A class path containing the libraries used by this project.
`String` | `name` The name for the project.
`List` | `propertyProcessors` Post-processors for per-project Sonar properties.
`boolean` | `skip` Tells whether to skip analysis of this project.
`boolean` | `skipDesignAnalysis` Tells whether to skip analysis of the project's design.
`List` | `sourceDirs` The directories containing the project's production source code to be analyzed.
`String` | `sourceEncoding` The character encoding for the project's source files.
`String` | `sourceExclusions` Source files to be excluded from analysis.
`List` | `testDirs` The directories containing the project's test source code to be analyzed.
`File` | `testReportPath` The directory containing the JUnit XML test report.
`String` | `version` The version of the project.
`File` | `workDir` The working directory for the analysis.

Method Summary
`void` | `java(Closure config)` Configures Java-related configuration options.
`void` | `withProjectProperties(Closure block)` Registers a closure for post-processing the per-project Sonar properties covered by `SonarProjectModel`, and for adding further properties not covered by that model.``

Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Property Detail

### baseDir

    File baseDir

  The base directory for the analysis. Defaults to `$project.projectDir`.

### binaryDirs

    List binaryDirs

  The directories containing the project's compiled code to be analyzed. Defaults to `main.output.classesDir`.

### cloverReportPath

    @SonarProperty("sonar.clover.reportPath")
    File cloverReportPath

  The Clover XML report file. Defaults to `null`.

### coberturaReportPath

    @SonarProperty("sonar.cobertura.reportPath")
    File coberturaReportPath

  The Cobertura XML report file. Defaults to `null`.

### date

    @SonarProperty("sonar.projectDate")
    String date

  The date when analysis was performed. Format is `yyyy-MM-dd` (e.g. `2010-12-25`). Defaults to the current date.

### description

    String description

  A description for the project. Defaults to `$project.description`.

### dynamicAnalysis

    @SonarProperty("sonar.dynamicAnalysis")
    String dynamicAnalysis

  Whether and how to perform dynamic analysis. Dynamic analysis includes the analysis of test and code coverage reports. The following values are allowed:
  - `reuseReports`: Test and/or coverage reports will be produced by the Gradle build and passed via `testReportPath`, `coberturaReportPath`, and `cloverReportPath`.
  - `false`: No dynamic analysis will be performed.
  - `true`: Test and/or coverage reports will be produced by Sonar. This mode is not supported by the Gradle Sonar plugin.
  Defaults to `reuseReports`.

### importSources

    @SonarProperty("sonar.importSources")
    boolean importSources

  Tells whether to the project's source code should be stored and made available via the Sonar web interface. Defaults to `true`.

### java

    @IncludeProperties
    SonarJavaSettings java

  Java-related configuration options.

### key

    String key

  The identifier for the project. Defaults to `$project.group:$project.name`.

### language

    @SonarProperty("sonar.language")
    String language

  The programming language to be analyzed. Only one language per project can be analyzed. Defaults to `java`.

### libraries

    FileCollection libraries

  A class path containing the libraries used by this project. Defaults to `project.sourceSets.main.compileClasspath + Jvm.current().runtimeJar`.

### name

    String name

  The name for the project. Defaults to `$project.name`.

### propertyProcessors

    List propertyProcessors

  Post-processors for per-project Sonar properties.
  See Also:
    withProjectProperties

### skip

    boolean skip

  Tells whether to skip analysis of this project. Allows to only analyze a subset of projects in a Gradle build. Defaults to `false`.

### skipDesignAnalysis

    @SonarProperty("sonar.skipDesign")
    boolean skipDesignAnalysis

  Tells whether to skip analysis of the project's design. Defaults to `false`.

### sourceDirs

    List sourceDirs

  The directories containing the project's production source code to be analyzed. Defaults to `project.sourceSets.main.allSource.srcDirs`.

### sourceEncoding

    @SonarProperty("sonar.sourceEncoding")
    String sourceEncoding

  The character encoding for the project's source files. Accepts the same values as Charset (e.g. `UTF-8`, `MacRoman`, `Shift_JIS`). Defaults to the JVM's platform encoding.``

### sourceExclusions

    @SonarProperty("sonar.exclusions")
    String sourceExclusions

  Source files to be excluded from analysis. Specified as comma-separated list of Ant-style patterns which are relative to a source directory.

  Example: `com/mycompany/*/.java, **/*Dummy.java`.

  Defaults to `null`.

### testDirs

    List testDirs

  The directories containing the project's test source code to be analyzed. Defaults to `project.sourceSets.test.allSource.srcDirs`.

### testReportPath

    @SonarProperty("sonar.surefire.reportsPath")
    File testReportPath

  The directory containing the JUnit XML test report. Defaults to `project.test.testResultsDir`.

### version

    String version

  The version of the project. Defaults to `$project.version`.

### workDir

    File workDir

  The working directory for the analysis. Defaults to `$project.buildDir/sonar`.``

Method Detail

### java

    void java(Closure config)

  Configures Java-related configuration options. The specified closure delegates to an instance of type SonarJavaSettings.
  Parameters:
    `config` - Java-related configuration options

### withProjectProperties

    void withProjectProperties(Closure block)

  Registers a closure for post-processing the per-project Sonar properties covered by `SonarProjectModel`, and for adding further properties not covered by that model. The properties are passed to the closure as a map of String keys and values. Keys correspond to the Sonar properties as described in the Sonar documentation.

  Evaluation of the closure is deferred until build execution time. If this method is called multiple times, closures will be evaluated in the order they have been registered.

  Example:

       withProjectProperties { props ->
           // add further properties
           props["some.sonar.property"] = "some value"
           props["another.sonar.property"] = "another value"

           // modify existing properties (rarely necessary)
           props["sonar.sourceEncoding"] = "UTF-8"
           props.remove("sonar.projectDate")
       }

  Parameters:
    `block` - a closure for post-processing per-project Sonar properties
  ``

Gradle API 1.10