JavaPluginConvention - Gradle DSL Version 2.14.1

# JavaPluginConvention

API Documentation: | `JavaPluginConvention`

Is mixed into the project when applying the `JavaBasePlugin` or the `JavaPlugin`.

### Properties

Property | Description
`docsDir` | Returns a file pointing to the root directory supposed to be used for all docs.
`docsDirName` | The name of the docs directory. Can be a name or a path relative to the build dir.
`sourceCompatibility` | The source compatibility used for compiling Java sources.
`sourceSets` | The source sets container.
`targetCompatibility` | The target compatibility used for compiling Java sources.
`testReportDir` | Returns a file pointing to the root directory to be used for reports.
`testReportDirName` | The name of the test reports directory. Can be a name or a path relative to `ReportingExtension.getBaseDir()`.
`testResultsDir` | Returns a file pointing to the root directory of the test results.
`testResultsDirName` | The name of the test results directory. Can be a name or a path relative to the build dir.

### Methods

Method | Description
`manifest()` | Creates a new instance of a `Manifest`.
`manifest(closure)` | Creates and configures a new instance of a `Manifest`. The given closure configures the new manifest instance before it is returned.

### Script blocks

Block | Description
`sourceSets` | Configures the source sets of this project.

### Property details

#### `File` `docsDir` (read-only)

Returns a file pointing to the root directory supposed to be used for all docs.

Default with `java` plugin:
  ``${project.buildDir}`/`${project.docsDirName}``

#### `String` `docsDirName`

The name of the docs directory. Can be a name or a path relative to the build dir.

Default with `java` plugin:
  `'docs'`

#### `JavaVersion` `sourceCompatibility`

The source compatibility used for compiling Java sources.

Default with `java` plugin:
  Value of the current used JVM (e.g. `JavaVersion.JAVA_1_6` on a 1.6 JVM).

#### `SourceSetContainer` `sourceSets` (read-only)

The source sets container.

#### `JavaVersion` `targetCompatibility`

The target compatibility used for compiling Java sources.

Default with `java` plugin:
  `project.sourceCompatibility`

#### `File` `testReportDir` (read-only)

Returns a file pointing to the root directory to be used for reports.

Default with `java` plugin:
  ``${project.reporting.baseDir}`/`${project.testReportDirName}``

#### `String` `testReportDirName`

The name of the test reports directory. Can be a name or a path relative to `ReportingExtension.getBaseDir()`.

Default with `java` plugin:
  `'tests'`

#### `File` `testResultsDir` (read-only)

Returns a file pointing to the root directory of the test results.

Default with `java` plugin:
  ``${project.buildDir}`/`${project.testResultsDirName}``

#### `String` `testResultsDirName`

The name of the test results directory. Can be a name or a path relative to the build dir.

Default with `java` plugin:
  `'test-results'`

### Method details

#### `Manifest` `manifest`()

Creates a new instance of a `Manifest`.

#### `Manifest` `manifest`(`Closure` closure)

Creates and configures a new instance of a `Manifest`. The given closure configures the new manifest instance before it is returned.

### Script block details

#### `sourceSets` { }

Configures the source sets of this project.

The given closure is executed to configure the `SourceSetContainer`. The `SourceSetContainer` is passed to the closure as its delegate.

See the example below how `SourceSet` 'main' is accessed and how the `SourceDirectorySet` 'java' is configured to exclude some package from compilation.

    apply plugin: 'java'

    sourceSets {
      main {
        java {
          exclude 'some/unwanted/package/**'
        }
      }
    }

Delegates to:
  `SourceSetContainer` from `sourceSets`