# Class AbstractArchiveTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.api.tasks.AbstractCopyTask
org.gradle.api.tasks.bundling.AbstractArchiveTask

All Implemented Interfaces:
  `Comparable<Task>, ContentFilterable, CopyProcessingSpec, CopySourceSpec, CopySpec, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.file.copy.CopySpecSource, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, Named, ExtensionAware, Task, PatternFilterable, Configurable<Task>`

Direct Known Subclasses:
  `Tar, Zip`

@DisableCachingByDefault(because="Abstract super-class, not to be instantiated directly") public abstract class AbstractArchiveTask extends AbstractCopyTask
`AbstractArchiveTask` is the base class for all archive tasks.

Since:
  0.7

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from interface Named

  `Named.Namer`

- ## Field Summary

  ### Fields inherited from interface Task

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

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractArchiveTask()`
  Creates a new `AbstractArchiveTask`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected org.gradle.api.internal.file.copy.CopyActionExecuter`
  `createCopyActionExecuter()`
  Create copy action executer.
  `abstract Property<String>`
  `getArchiveAppendix()`
  Returns the appendix part of the archive name, if any.
  `abstract Property<String>`
  `getArchiveBaseName()`
  Returns the base name of the archive.
  `abstract Property<String>`
  `getArchiveClassifier()`
  Returns the classifier part of the archive name, if any.
  `abstract Property<String>`
  `getArchiveExtension()`
  Returns the extension part of the archive name.
  `Provider<RegularFile>`
  `getArchiveFile()`
  The `RegularFile` where the archive is constructed.
  `abstract Property<String>`
  `getArchiveFileName()`
  Returns the archive name.
  `abstract Property<String>`
  `getArchiveVersion()`
  Returns the version part of the archive name.
  `abstract DirectoryProperty`
  `getDestinationDirectory()`
  The directory where the archive will be placed.
  `protected abstract FileSystemOperations`
  `getFileSystemOperations()`
  `abstract Property<Long>`
  `getReproducibleFileTimestamp()`
  Specifies the reproducible file timestamp used for each entry in the archive in milliseconds from the epoch of 1970-01-01T00:00:00Z.
  `AbstractArchiveTask`
  `into(Object destPath)`
  Specifies the destination directory *inside* the archive for the files.
  `AbstractArchiveTask`
  `into(Object destPath, Closure configureClosure)`
  Creates and configures a child `CopySpec` with a destination directory *inside* the archive for the files.
  `CopySpec`
  `into(Object destPath, Action<? super CopySpec> copySpec)`
  Creates and configures a child `CopySpec` with a destination directory *inside* the archive for the files.
  `boolean`
  `isPreserveFileTimestamps()`
  Specifies whether file timestamps should be preserved in the archive.
  `boolean`
  `isReproducibleFileOrder()`
  Specifies whether to enforce a reproducible file order when reading files from directories.
  `void`
  `setPreserveFileTimestamps(boolean preserveFileTimestamps)`
  Specifies whether file timestamps should be preserved in the archive.
  `void`
  `setReproducibleFileOrder(boolean reproducibleFileOrder)`
  Specifies whether to enforce a reproducible file order when reading files from directories.
  `void`
  `useFileSystemPermissions()`
  Sets the directory and file permissions for archived files to be read from the file system.

  ### Methods inherited from class AbstractCopyTask

  `copy, createCopyAction, createRootSpec, dirPermissions, eachFile, eachFile, exclude, exclude, exclude, exclude, expand, expand, filePermissions, filesMatching, filesMatching, filesNotMatching, filesNotMatching, filter, filter, filter, filter, from, from, from, getDirectoryFileTreeFactory, getDirPermissions, getDocumentationRegistry, getDuplicatesStrategy, getExcludes, getFileLookup, getFilePermissions, getFileResolver, getFileSystem, getFilteringCharset, getIncludeEmptyDirs, getIncludes, getInstantiator, getMainSpec, getObjectFactory, getPropertyFactory, getRootSpec, getSource, include, include, include, include, isCaseSensitive, rename, rename, rename, rename, setCaseSensitive, setDuplicatesStrategy, setExcludes, setFilteringCharset, setIncludeEmptyDirs, setIncludes, with`

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

  `conventionMapping, conventionMapping, getConventionMapping`

  ### Methods inherited from class DefaultTask

  `compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService`

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

  `acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getLoggingManager, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, service, setImpliesSubProjects`

  ### Methods inherited from class Object

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

  ### Methods inherited from interface Task

  `doNotTrackState, notCompatibleWithConfigurationCache, service`

- ## Constructor Details

  - ### AbstractArchiveTask

    public AbstractArchiveTask()
    Creates a new `AbstractArchiveTask`.
    Since:
      0.8

- ## Method Details

  - ### getFileSystemOperations

    @Inject protected abstract FileSystemOperations getFileSystemOperations()

  - ### getArchiveFileName

    @Internal("Represented as part of archiveFile") public abstract Property<String> getArchiveFileName()
    Returns the archive name. If the name has not been explicitly set, the pattern for the name is: `[archiveBaseName]-[archiveAppendix]-[archiveVersion]-[archiveClassifier].[archiveExtension]`
    Returns:
      the archive name.
    Since:
      5.1

  - ### getArchiveFile

    @OutputFile public Provider<RegularFile> getArchiveFile()
    The `RegularFile` where the archive is constructed. The path is simply the `destinationDirectory` plus the `archiveFileName`.
    Returns:
      a `RegularFile` object with the path to the archive
    Since:
      5.1

  - ### getDestinationDirectory

    @Internal("Represented by the archiveFile") public abstract DirectoryProperty getDestinationDirectory()
    The directory where the archive will be placed.
    Since:
      5.1

  - ### getArchiveBaseName

    @Internal("Represented as part of archiveFile") public abstract Property<String> getArchiveBaseName()
    Returns the base name of the archive.
    Returns:
      the base name. Internal property may be null.
    Since:
      5.1

  - ### getArchiveAppendix

    @Internal("Represented as part of archiveFile") public abstract Property<String> getArchiveAppendix()
    Returns the appendix part of the archive name, if any.
    Returns:
      the appendix. May be null
    Since:
      5.1

  - ### getArchiveVersion

    @Internal("Represented as part of archiveFile") public abstract Property<String> getArchiveVersion()
    Returns the version part of the archive name.
    Returns:
      the version. Internal property may be null.
    Since:
      5.1

  - ### getArchiveExtension

    @Internal("Represented as part of archiveFile") public abstract Property<String> getArchiveExtension()
    Returns the extension part of the archive name.
    Since:
      5.1

  - ### getArchiveClassifier

    @Internal("Represented as part of archiveFile") public abstract Property<String> getArchiveClassifier()
    Returns the classifier part of the archive name, if any.
    Returns:
      The classifier. Internal property may be null.
    Since:
      5.1

  - ### into

    public AbstractArchiveTask into(Object destPath)
    Specifies the destination directory *inside* the archive for the files. The destination is evaluated as per `Project.file(Object)`. Don't mix it up with `getDestinationDirectory()` which specifies the output directory for the archive.
    Specified by:
      `into` in interface `CopyProcessingSpec`
    Specified by:
      `into` in interface `CopySpec`
    Overrides:
      `into` in class `AbstractCopyTask`
    Parameters:
      `destPath` - destination directory *inside* the archive for the files
    Returns:
      this

  - ### into

    public AbstractArchiveTask into(Object destPath, Closure configureClosure)
    Creates and configures a child `CopySpec` with a destination directory *inside* the archive for the files. The destination is evaluated as per `Project.file(Object)`. Don't mix it up with `getDestinationDirectory()` which specifies the output directory for the archive.
    Specified by:
      `into` in interface `CopySpec`
    Overrides:
      `into` in class `AbstractCopyTask`
    Parameters:
      `destPath` - destination directory *inside* the archive for the files
      `configureClosure` - The closure to use to configure the child `CopySpec`.
    Returns:
      this

  - ### into

    public CopySpec into(Object destPath, Action<? super CopySpec> copySpec)
    Creates and configures a child `CopySpec` with a destination directory *inside* the archive for the files. The destination is evaluated as per `Project.file(Object)`. Don't mix it up with `getDestinationDirectory()` which specifies the output directory for the archive.
    Specified by:
      `into` in interface `CopySpec`
    Overrides:
      `into` in class `AbstractCopyTask`
    Parameters:
      `destPath` - destination directory *inside* the archive for the files
      `copySpec` - The closure to use to configure the child `CopySpec`.
    Returns:
      this

  - ### getReproducibleFileTimestamp

    @Incubating @Input @Optional public abstract Property<Long> getReproducibleFileTimestamp()
    Specifies the reproducible file timestamp used for each entry in the archive in milliseconds from the epoch of 1970-01-01T00:00:00Z.

    If not set, then each archive entry will use the value as determined by the `preserveFileTimestamps` property. If set, then each archive entry will use the reproducible file timestamp. If set, the `preserveFileTimestamps` property must be `false` (the default value), otherwise the task fails.

    Each archive format has a minimum supported timestamp, and smaller values are raised to that minimum: 1980-02-01 00:00 for ZIP archives and 1970-01-02T00:00:00Z for TAR archives.

    Returns:
      the reproducible file timestamp used for each entry in the archive
    Since:
      9.7.0

  - ### isPreserveFileTimestamps

    @Input public boolean isPreserveFileTimestamps()
    Specifies whether file timestamps should be preserved in the archive.

    If `false` this ensures that archive entries have the same time for builds between different machines, Java versions and operating systems.

    Gradle defaults to `false` if not set explictly starting Gradle 9.0.0

    Returns:
      `true` if file timestamps should be preserved for archive entries
    Since:
      3.4

  - ### setPreserveFileTimestamps

    public void setPreserveFileTimestamps(boolean preserveFileTimestamps)
    Specifies whether file timestamps should be preserved in the archive.

    If `false` this ensures that archive entries have the same time for builds between different machines, Java versions and operating systems.

    Gradle defaults to `false` if not set explictly starting Gradle 9.0.0

    Parameters:
      `preserveFileTimestamps` - `true` if file timestamps should be preserved for archive entries
    Since:
      3.4

  - ### isReproducibleFileOrder

    @Input public boolean isReproducibleFileOrder()
    Specifies whether to enforce a reproducible file order when reading files from directories.

    Gradle will then walk the directories on disk which are part of this archive in a reproducible order independent of file systems and operating systems. This helps Gradle reliably produce byte-for-byte reproducible archives.

    Gradle defaults to `true` if not set explictly starting Gradle 9.0.0

    Returns:
      `true` if the files should read from disk in a reproducible order.
    Since:
      3.4

  - ### setReproducibleFileOrder

    public void setReproducibleFileOrder(boolean reproducibleFileOrder)
    Specifies whether to enforce a reproducible file order when reading files from directories.

    Gradle will then walk the directories on disk which are part of this archive in a reproducible order independent of file systems and operating systems. This helps Gradle reliably produce byte-for-byte reproducible archives.

    Gradle defaults to `true` if not set explictly starting Gradle 9.0.0

    Parameters:
      `reproducibleFileOrder` - `true` if the files should read from disk in a reproducible order.
    Since:
      3.4

  - ### useFileSystemPermissions

    public void useFileSystemPermissions()
    Sets the directory and file permissions for archived files to be read from the file system.

    Any subsequent configuration of `AbstractCopyTask.getDirPermissions()` or `AbstractCopyTask.getFilePermissions()` will override this setting, but only for the specifically configured property.

    Note: On Windows, file system permissions are not supported, and permissions will be set to `755` for directories and `644` for files.

    This setting can also be applied to all archive tasks of the build via `org.gradle.archives.use-file-system-permissions=true` property.

    Since:
      9.0.0

  - ### createCopyActionExecuter

    protected org.gradle.api.internal.file.copy.CopyActionExecuter createCopyActionExecuter()
    Description copied from class: `AbstractCopyTask`
    Create copy action executer.
    Overrides:
      `createCopyActionExecuter` in class `AbstractCopyTask`