Package org.gradle.jvm.tasks.api

## Class ApiJar

- java.lang.Object
- - org.gradle.api.internal.AbstractTask
  - - org.gradle.api.DefaultTask
    - - org.gradle.api.internal.ConventionTask
      - - org.gradle.api.tasks.SourceTask
        - - org.gradle.jvm.tasks.api.ApiJar

- All Implemented Interfaces:
    `Comparable<Task>`, `org.gradle.api.internal.DynamicObjectAware`, `org.gradle.api.internal.IConventionAware`, `org.gradle.api.internal.TaskInternal`, `ExtensionAware`, `Task`, `PatternFilterable`, `org.gradle.util.Configurable<Task>`

      @Incubating
      @Deprecated
      public class ApiJar
      extends SourceTask

  Deprecated.
  Assembles an "API Jar" containing only the members of a library's public API.

  This task and the Jar it produces are designed primarily for internal use in support of Gradle's "compile avoidance" performance feature. The task is automatically included in the task graph for any JVM library that declares an `api { ... }` specification, and the resulting Jar will automatically be placed on the compile time classpath of projects that depend on the library in lieu of the library's complete so-called "Runtime Jar".

  Swapping the API Jar in for the Runtime Jar at compile time is what makes "compile avoidance" possible: because the contents of the API Jar change only when actual API changes are made, the API Jar passes Gradle's up-to-date checks, even if the implementation in the Runtime Jar has changed. Ultimately, this means that projects depending on the library in question will need to recompile potentially far less often.

  In order to ensure that API Jars change as infrequently as possible, this task and its supporting classes ensure that only actual public API members are included in the API Jar, and that the methods among those members are stripped of their implementation. Because the members included in API Jars exist only for compilation purposes, they need no actual implementation, and for this reason, all such methods throw `UnsupportedOperationException` in the unlikely event that they are present on the classpath and invoked at runtime.

  The inputs to this task are Java class files which must be provided via `TaskInputs`.

  Since:
    2.10
  See Also:
    `JvmComponentPlugin`

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.gradle.api.Task

      `Task.Namer`

  - ### Field Summary

    - ### Fields inherited from interface org.gradle.api.Task

      `TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ApiJar()` | Deprecated.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `createApiJar()` | Deprecated.
    `Set<String>` | `getExportedPackages()` | Deprecated.
    `File` | `getOutputFile()` | Deprecated.
    `FileTree` | `getSource()` | Deprecated. Returns the source for this task, after the include and exclude patterns have been applied.
    `void` | `setExportedPackages​(Set<String> exportedPackages)` | Deprecated.
    `void` | `setOutputFile​(File outputFile)` | Deprecated.

    - ### Methods inherited from class org.gradle.api.tasks.SourceTask

      `exclude, exclude, exclude, exclude, getExcludes, getIncludes, getPatternSetFactory, include, include, include, include, setExcludes, setIncludes, setSource, setSource, source`

    - ### Methods inherited from class org.gradle.api.internal.ConventionTask

      `conventionMapping, conventionMapping, getConventionMapping`

    - ### Methods inherited from class org.gradle.api.internal.AbstractTask

      `appendParallelSafeAction, compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getIdentityPath, getImpliesSubProjects, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOnlyIf, getOutputs, getPath, getProject, getRequiredServices, getServices, getSharedResources, getShouldRunAfter, getStandardOutputCapture, getState, getTaskActions, getTaskDependencies, getTaskIdentity, getTemporaryDir, getTemporaryDirFactory, getTimeout, hasProperty, hasTaskActions, injectIntoNewInstance, isEnabled, isHasCustomActions, mustRunAfter, onlyIf, onlyIf, prependParallelSafeAction, property, replaceLogger, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setImpliesSubProjects, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService`

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

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

- - ### Constructor Detail

    - #### ApiJar

          public ApiJar()

      Deprecated.

  - ### Method Detail

    - #### getSource

          @PathSensitive(RELATIVE)
          public FileTree getSource()

      Deprecated.
      Returns the source for this task, after the include and exclude patterns have been applied. Ignores source files which do not exist.

      The `PathSensitivity` for the sources is configured to be `PathSensitivity.ABSOLUTE`. If your sources are less strict, please change it accordingly by overriding this method in your subclass.

      Overrides:
        `getSource` in class `SourceTask`
      Returns:
        The source.

    - #### getExportedPackages

          @Input
          public Set<String> getExportedPackages()

      Deprecated.

    - #### setExportedPackages

          public void setExportedPackages​(Set<String> exportedPackages)

      Deprecated.

    - #### getOutputFile

          @OutputFile
          public File getOutputFile()

      Deprecated.

    - #### setOutputFile

          public void setOutputFile​(File outputFile)

      Deprecated.

    - #### createApiJar

          public void createApiJar()
                            throws IOException

      Deprecated.
      Throws:
        `IOException`