แชร์ผ่าน


ArchiveFiles@2 - Archive files v2 task

Archive files using compression formats such as .7z, .rar, .tar., .gz, and .zip.

Inputs

rootFolderOrFile - Root folder or file to archive
string. Required. Default value: $(Build.BinariesDirectory).

Name of the root folder or the file path to files to add to the archive. For folders, everything in the named folder is added to the archive.


includeRootFolder - Prepend root folder name to archive paths
boolean. Default value: true.

Prepends the root folder name to file paths in the archive. Otherwise, all file paths will start one level lower.

For example, if the root folder is: /home/user/output/classes/ and the file path: com/acme/Main.class. The resulting archive will contain: classes/com/acme/Main.class. Otherwise, the resulting archive will contain: com/acme/Main.class.


archiveType - Archive type
string. Required. Allowed values: zip, 7z, tar, wim. Default value: zip.

Specifies a compression format. Valid formats include:

  • zip - Default. Choose this format for all zip compatible types such as .zip, .jar, .war, .ear
  • 7z - 7-Zip format, (.7z)
  • tar - tar format, use for compressed tars including .tar.gz, .tar.bz2, .tar.xz
  • wim - wim format, .wim

Example, to create an archive named foo.jar:

  • Select compression format zip
  • Specify the name of the archive file to create: foo.jar

tarCompression - Tar compression
string. Optional. Use when archiveType = tar. Allowed values: gz, bz2, xz, none. Default value: gz.

Set a compression format or choose None to create an uncompressed .tar file.

  • gz - Default format for gzip compression (.tar.gz, .tar.tgz, .taz)
  • bz2 - bzip2 compression (.tar.bz2, .tz2, .tbz2)
  • xz - xz compression (.tar.xz, .txz)

archiveFile - Archive file to create
string. Required. Default value: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip.

Specify the name of the archive file to create. For example, to create foo.tgz:

  • Set archive type: tar
  • Set tar compression: gz

replaceExistingArchive - Replace existing archive
boolean. Default value: true.

By default, overwrites an existing archive. Otherwise, when set to false, uncompressed tar files are added to the existing archive.

Supported file formats that can be added to an existing archive:

  • zip
  • 7z
  • tar - Only uncompressed
  • wim

Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Remarks

Use this task to create an archive file from a source folder. Standard archive formats are supported including .zip, .jar, .war, .ear, .tar, .7z, and more.

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version All supported agent versions.
Task category Utility