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
    extends java.lang.Object

Per-project configuration options.

Property Summary
`java.io.File` | `baseDir` The base directory for the analysis.
`java.util.List` | `binaryDirs` The directories containing the project's compiled code to be analyzed.
`java.io.File` | `cloverReportPath` The Clover XML report file.
`java.io.File` | `coberturaReportPath` The Cobertura XML report file.
`java.lang.String` | `date` The date when analyis was performed.
`java.lang.String` | `description` A description for the project.
`java.lang.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.
`java.lang.String` | `key` The identifier for the project.
`java.lang.String` | `language` The programming language to be analyzed.
`FileCollection` | `libraries` A class path containing the libraries used by this project.
`java.lang.String` | `name` The name for the project.
`java.util.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.
`java.util.List` | `sourceDirs` The directories containing the project's production source code to be analyzed.
`java.lang.String` | `sourceEncoding` The character encoding for the project's source files.
`java.lang.String` | `sourceExclusions` Source files to be excluded from analysis.
`java.util.List` | `testDirs` The directories containing the project's test source code to be analyzed.
`java.io.File` | `testReportPath` The directory containing the JUnit XML test report.
`java.lang.String` | `version` The version of the project.
`java.io.File` | `workDir` The working directory for the analysis.

Method Summary
`void` | `java(groovy.lang.Closure config)` Configures Java-related configuration options.
`void` | `withProjectProperties(groovy.lang.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 java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Property Detail

### baseDir

    java.io.File baseDir

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

### binaryDirs

    java.util.List binaryDirs

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

### cloverReportPath

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

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

### coberturaReportPath

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

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

### date

    @SonarProperty("sonar.projectDate")
    java.lang.String date

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

### description

    java.lang.String description

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

### dynamicAnalysis

    @SonarProperty("sonar.dynamicAnalysis")
    java.lang.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

    java.lang.String key

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

### language

    @SonarProperty("sonar.language")
    java.lang.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

    java.lang.String name

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

### propertyProcessors

    java.util.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

    java.util.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")
    java.lang.String sourceEncoding

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

### sourceExclusions

    @SonarProperty("sonar.exclusions")
    java.lang.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

    java.util.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")
    java.io.File testReportPath

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

### version

    java.lang.String version

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

### workDir

    java.io.File workDir

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

Method Detail

### java

    void java(groovy.lang.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(groovy.lang.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
  ``

Groovy Documentation