共用方式為


ArchiveFiles@1 - Archive Files v1 task

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

Inputs

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

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


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

By default, prepends the root folder name to file paths within the archive. When set to false, all file paths will start one level lower.

For example, if the root folder path 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: default (zip), 7z, tar, wim. Default value: default.

Specifies a compression format.

For example, to create an archive named foo.jar:

  • Set compression format: zip
  • Set the archive name: foo.jar

For all tar files (including compressed ones), choose tar.


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

Selects a compression scheme or none to create an uncompressed tar file.


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.

Overwrites an existing archive. If not specified, files are added to the archive.


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

There is a newer version of the Archive Files task available.

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

See also