org.gradle.api.tasks.compile

## Class CompileOptions

- java.lang.Object
- - org.gradle.api.tasks.compile.AbstractOptions
  - - org.gradle.api.tasks.compile.CompileOptions

- All Implemented Interfaces:
    Serializable

      public class CompileOptions
      extends AbstractOptions

  Main options for Java compilation.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompileOptions()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `CompileOptions` | `debug(Map<String,Object> debugArgs)` Convenience method to set `DebugOptions` with named parameter syntax.
    `CompileOptions` | `depend(Map<String,Object> dependArgs)` Convenience method to set `DependOptions` with named parameter syntax.
    `protected boolean` | `excludeFromAntProperties(String fieldName)`
    `CompileOptions` | `fork(Map<String,Object> forkArgs)` Convenience method to set `ForkOptions` with named parameter syntax.
    `protected String` | `getAntPropertyName(String fieldName)`
    `protected Object` | `getAntPropertyValue(String fieldName, Object value)`
    `String` | `getBootClasspath()` Returns the bootstrap classpath to be used for the compiler process.
    `List<String>` | `getCompilerArgs()` Returns any additional arguments to be passed to the compiler.
    `DebugOptions` | `getDebugOptions()` Returns options for generating debugging information.
    `DependOptions` | `getDependOptions()` Returns options for using the Ant `<depend>` task.
    `String` | `getEncoding()` Returns the character encoding to be used when reading source files.
    `String` | `getExtensionDirs()` Returns the extension dirs to be used for the compiler process.
    `ForkOptions` | `getForkOptions()` Returns options for running the compiler in a child process.
    `FileCollection` | `getSourcepath()` The source path to use for the compilation.
    `boolean` | `isDebug()` Tells whether to include debugging information in the generated class files.
    `boolean` | `isDeprecation()` Tells whether to log details of usage of deprecated members or classes.
    `boolean` | `isFailOnError()` Tells whether to fail the build when compilation fails.
    `boolean` | `isFork()` Tells whether to run the compiler in its own process.
    `boolean` | `isIncremental()` informs whether to use experimental incremental compilation feature.
    `boolean` | `isListFiles()` Tells whether to log the files to be compiled.
    `boolean` | `isUseDepend()` Tells whether to use the Ant `<depend>` task.
    `boolean` | `isVerbose()` Tells whether to produce verbose output.
    `boolean` | `isWarnings()` Tells whether to log warning messages.
    `Map<String,Object>` | `optionMap()` Internal method.
    `void` | `setBootClasspath(String bootClasspath)` Sets the bootstrap classpath to be used for the compiler process.
    `void` | `setCompilerArgs(List<String> compilerArgs)` Sets any additional arguments to be passed to the compiler.
    `void` | `setDebug(boolean debug)` Sets whether to include debugging information in the generated class files.
    `void` | `setDebugOptions(DebugOptions debugOptions)` Sets options for generating debugging information.
    `void` | `setDependOptions(DependOptions dependOptions)` Sets options for using the Ant `<depend>` task.
    `void` | `setDeprecation(boolean deprecation)` Sets whether to log details of usage of deprecated members or classes.
    `void` | `setEncoding(String encoding)` Sets the character encoding to be used when reading source files.
    `void` | `setExtensionDirs(String extensionDirs)` Sets the extension dirs to be used for the compiler process.
    `void` | `setFailOnError(boolean failOnError)` Sets whether to fail the build when compilation fails.
    `void` | `setFork(boolean fork)` Sets whether to run the compiler in its own process.
    `void` | `setForkOptions(ForkOptions forkOptions)` Sets options for running the compiler in a child process.
    `CompileOptions` | `setIncremental(boolean incremental)`
    `void` | `setListFiles(boolean listFiles)` Sets whether to log the files to be compiled.
    `void` | `setSourcepath(FileCollection sourcepath)` Sets the source path to use for the compilation.
    `void` | `setUseDepend(boolean useDepend)` Sets whether to use the Ant `<depend>` task.
    `void` | `setVerbose(boolean verbose)` Sets whether to produce verbose output.
    `void` | `setWarnings(boolean warnings)` Sets whether to log warning messages.

    - ### Methods inherited from class org.gradle.api.tasks.compile.AbstractOptions

      `define`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CompileOptions

          public CompileOptions()

  - ### Method Detail

    - #### isFailOnError

          @Input
          public boolean isFailOnError()

      Tells whether to fail the build when compilation fails. Defaults to `true`.

    - #### setFailOnError

          public void setFailOnError(boolean failOnError)

      Sets whether to fail the build when compilation fails. Defaults to `true`.

    - #### isVerbose

          public boolean isVerbose()

      Tells whether to produce verbose output. Defaults to `false`.

    - #### setVerbose

          public void setVerbose(boolean verbose)

      Sets whether to produce verbose output. Defaults to `false`.

    - #### isListFiles

          public boolean isListFiles()

      Tells whether to log the files to be compiled. Defaults to `false`.

    - #### setListFiles

          public void setListFiles(boolean listFiles)

      Sets whether to log the files to be compiled. Defaults to `false`.

    - #### isDeprecation

          public boolean isDeprecation()

      Tells whether to log details of usage of deprecated members or classes. Defaults to `false`.

    - #### setDeprecation

          public void setDeprecation(boolean deprecation)

      Sets whether to log details of usage of deprecated members or classes. Defaults to `false`.

    - #### isWarnings

          public boolean isWarnings()

      Tells whether to log warning messages. The default is `true`.

    - #### setWarnings

          public void setWarnings(boolean warnings)

      Sets whether to log warning messages. The default is `true`.

    - #### getEncoding

          @Input
          @Optional
          public String getEncoding()

      Returns the character encoding to be used when reading source files. Defaults to `null`, in which case the platform default encoding will be used.

    - #### setEncoding

          public void setEncoding(String encoding)

      Sets the character encoding to be used when reading source files. Defaults to `null`, in which case the platform default encoding will be used.

    - #### isDebug

          @Input
          public boolean isDebug()

      Tells whether to include debugging information in the generated class files. Defaults to `true`. See `DebugOptions.getDebugLevel()` for which debugging information will be generated.

    - #### setDebug

          public void setDebug(boolean debug)

      Sets whether to include debugging information in the generated class files. Defaults to `true`. See `DebugOptions.getDebugLevel()` for which debugging information will be generated.

    - #### getDebugOptions

          public DebugOptions getDebugOptions()

      Returns options for generating debugging information.

    - #### setDebugOptions

          public void setDebugOptions(DebugOptions debugOptions)

      Sets options for generating debugging information.

    - #### isFork

          public boolean isFork()

      Tells whether to run the compiler in its own process. Note that this does not necessarily mean that a new process will be created for each compile task. Defaults to `false`.

    - #### setFork

          public void setFork(boolean fork)

      Sets whether to run the compiler in its own process. Note that this does not necessarily mean that a new process will be created for each compile task. Defaults to `false`.

    - #### getForkOptions

          public ForkOptions getForkOptions()

      Returns options for running the compiler in a child process.

    - #### setForkOptions

          public void setForkOptions(ForkOptions forkOptions)

      Sets options for running the compiler in a child process.

    - #### isUseDepend

          public boolean isUseDepend()

      Tells whether to use the Ant `<depend>` task. Only takes effect if `useAnt` is `true`. Defaults to `false`.

    - #### setUseDepend

          public void setUseDepend(boolean useDepend)

      Sets whether to use the Ant `<depend>` task. Only takes effect if `useAnt` is `true`. Defaults to `false`.

    - #### getDependOptions

          public DependOptions getDependOptions()

      Returns options for using the Ant `<depend>` task.

    - #### setDependOptions

          public void setDependOptions(DependOptions dependOptions)

      Sets options for using the Ant `<depend>` task.

    - #### getBootClasspath

          @Input
          @Optional
          public String getBootClasspath()

      Returns the bootstrap classpath to be used for the compiler process. Defaults to `null`.

    - #### setBootClasspath

          public void setBootClasspath(String bootClasspath)

      Sets the bootstrap classpath to be used for the compiler process. Defaults to `null`.

    - #### getExtensionDirs

          @Input
          @Optional
          public String getExtensionDirs()

      Returns the extension dirs to be used for the compiler process. Defaults to `null`.

    - #### setExtensionDirs

          public void setExtensionDirs(String extensionDirs)

      Sets the extension dirs to be used for the compiler process. Defaults to `null`.

    - #### getCompilerArgs

          @Input
          public List<String> getCompilerArgs()

      Returns any additional arguments to be passed to the compiler. Defaults to the empty list.

    - #### setCompilerArgs

          public void setCompilerArgs(List<String> compilerArgs)

      Sets any additional arguments to be passed to the compiler. Defaults to the empty list.

    - #### fork

          public CompileOptions fork(Map<String,Object> forkArgs)

      Convenience method to set `ForkOptions` with named parameter syntax. Calling this method will set `fork` to `true`.

    - #### debug

          public CompileOptions debug(Map<String,Object> debugArgs)

      Convenience method to set `DebugOptions` with named parameter syntax. Calling this method will set `debug` to `true`.

    - #### depend

          public CompileOptions depend(Map<String,Object> dependArgs)

      Convenience method to set `DependOptions` with named parameter syntax. Calling this method will set `useDepend` to `true`.

    - #### setIncremental

          @Incubating
          public CompileOptions setIncremental(boolean incremental)

    - #### optionMap

          public Map<String,Object> optionMap()

      Internal method.
      Overrides:
        `optionMap` in class `AbstractOptions`

    - #### excludeFromAntProperties

          protected boolean excludeFromAntProperties(String fieldName)

      Overrides:
        `excludeFromAntProperties` in class `AbstractOptions`

    - #### getAntPropertyName

          protected String getAntPropertyName(String fieldName)

      Overrides:
        `getAntPropertyName` in class `AbstractOptions`

    - #### getAntPropertyValue

          protected Object getAntPropertyValue(String fieldName,
                                   Object value)

      Overrides:
        `getAntPropertyValue` in class `AbstractOptions`

    - #### isIncremental

          @Incubating
          public boolean isIncremental()

      informs whether to use experimental incremental compilation feature. See `setIncremental(boolean)`

    - #### getSourcepath

          @Input
          @Optional
          @Incubating
          public FileCollection getSourcepath()

      The source path to use for the compilation.

      The source path indicates the location of source files that may be compiled if necessary. It is effectively a complement to the class path, where the classes to be compiled against are in source form. It does not indicate the actual primary source being compiled.

      The source path feature of the Java compiler is rarely needed for modern builds that use dependency management.

      The default value for the source path is `null`, which indicates an empty source path. Note that this is different to the default value for the `-sourcepath` option for `javac`, which is to use the value specified by `-classpath`. If you wish to use any source path, it must be explicitly set.

      Returns:
        the source path
      See Also:
        `setSourcepath(FileCollection)`

    - #### setSourcepath

          @Incubating
          public void setSourcepath(FileCollection sourcepath)

      Sets the source path to use for the compilation.
      Parameters:
        `sourcepath` - the source path