Package: org.gradle.api.plugins

## [Groovy] Class JavaPluginConvention

- org.gradle.api.plugins.JavaPluginConvention

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

- - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `String` | `dependencyCacheDirName`
    `String` | `docsDirName` The name of the docs directory.
    `org.gradle.api.internal.project.ProjectInternal` | `project`
    `SourceSetContainer` | `sourceSets` The source sets container.
    `String` | `testReportDirName` The name of the test reports directory.
    `String` | `testResultsDirName` The name of the test results directory.

  - ### Constructor Summary

    Constructors
    Constructor and description
    `JavaPluginConvention (org.gradle.api.internal.project.ProjectInternal project, org.gradle.internal.reflect.Instantiator instantiator)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `File` | `getDependencyCacheDir()`
    `File` | `getDocsDir()` Returns a file pointing to the root directory supposed to be used for all docs.
    `JavaVersion` | `getSourceCompatibility()` Returns the source compatibility used for compiling Java sources.
    `JavaVersion` | `getTargetCompatibility()` Returns the target compatibility used for compiling Java sources.
    `File` | `getTestReportDir()` Returns a file pointing to the root directory to be used for reports.
    `File` | `getTestResultsDir()` Returns a file pointing to the root directory of the test results.
    `Manifest` | `manifest()` Creates a new instance of a Manifest.
    `Manifest` | `manifest(groovy.lang.Closure closure)` Creates and configures a new instance of a Manifest.
    `void` | `setSourceCompatibility(def value)` Sets the source compatibility used for compiling Java sources.
    `void` | `setTargetCompatibility(def value)` Sets the target compatibility used for compiling Java sources.
    `def` | `sourceSets(groovy.lang.Closure closure)` Configures the source sets of this project.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Property Detail

    - #### String dependencyCacheDirName

    - #### String docsDirName

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

    - #### org.gradle.api.internal.project.ProjectInternal project

    - #### final SourceSetContainer sourceSets

      The source sets container.

    - #### String testReportDirName

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

    - #### String testResultsDirName

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

  - ### Constructor Detail

    - #### JavaPluginConvention(org.gradle.api.internal.project.ProjectInternal project, org.gradle.internal.reflect.Instantiator instantiator)

  - ### Method Detail

    - #### File getDependencyCacheDir()

    - #### File getDocsDir()

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

    - #### JavaVersion getSourceCompatibility()

      Returns the source compatibility used for compiling Java sources.

    - #### JavaVersion getTargetCompatibility()

      Returns the target compatibility used for compiling Java sources.

    - #### File getTestReportDir()

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

    - #### File getTestResultsDir()

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

    - #### Manifest manifest()

      Creates a new instance of a Manifest.

    - #### Manifest manifest(groovy.lang.Closure closure)

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

      Parameters:
        `closure` - The closure to use to configure the manifest.

    - #### void setSourceCompatibility(def value)

      Sets the source compatibility used for compiling Java sources.

      value:
        The value for the source compatibility as defined by JavaVersion.toVersion

    - #### void setTargetCompatibility(def value)

      Sets the target compatibility used for compiling Java sources.

      value:
        The value for the target compatibilty as defined by JavaVersion.toVersion

    - #### def sourceSets(groovy.lang.Closure closure)

      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/**'
               }
             }
           }

      Parameters:
        `closure` - The closure to execute.