Package: org.gradle.api.tasks.compile

## [Java] Class JavaCompile

- org.gradle.api.tasks.compile.JavaCompile

- Compiles Java source files.

           apply plugin: 'java'
           compileJava {
               //enable compilation in a separate daemon process
               options.fork = true

               //enable incremental compilation
               options.incremental = true
           }

- - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `protected void` | `compile(IncrementalTaskInputs inputs)`
    `protected void` | `compile()`
    `protected Factory<AntBuilder>` | `getAntBuilderFactory()`
    `protected CacheRepository` | `getCacheRepository()`
    `File` | `getDependencyCacheDir()`
    `protected GeneralCompileCaches` | `getGeneralCompileCaches()`
    `CompileOptions` | `getOptions()` Returns the compilation options.
    `JavaToolChain` | `getToolChain()` Returns the tool chain that will be used to compile the Java source.
    `void` | `setDependencyCacheDir(File dependencyCacheDir)`
    `void` | `setToolChain(JavaToolChain toolChain)` Sets the tool chain that should be used to compile the Java source.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class AbstractCompile` | `compile, getClasspath, getDestinationDir, getSourceCompatibility, getTargetCompatibility, setClasspath, setDestinationDir, setSourceCompatibility, setTargetCompatibility`

- - ### Method Detail

    - #### @TaskAction protected void compile(IncrementalTaskInputs inputs)

    - #### protected void compile()

    - #### @Inject protected Factory<AntBuilder> getAntBuilderFactory()

    - #### @Inject protected CacheRepository getCacheRepository()

    - #### @OutputDirectory public File getDependencyCacheDir()

    - #### @Inject protected GeneralCompileCaches getGeneralCompileCaches()

    - #### @Nested public CompileOptions getOptions()

      Returns the compilation options.

      Returns:
        The compilation options.

    - #### @Incubating public JavaToolChain getToolChain()

      Returns the tool chain that will be used to compile the Java source.

      Returns:
        The tool chain.

    - #### public void setDependencyCacheDir(File dependencyCacheDir)

    - #### @Incubating public void setToolChain(JavaToolChain toolChain)

      Sets the tool chain that should be used to compile the Java source.

      Parameters:
        `toolChain` - The tool chain.