问题描述
我有一个 Gradle 版本,它正在将 zip 存档发布到 Artifactory.一些下游用例需要来自 zip 工件的单个文件,因此下载整个存档效率低下.是否可以从 zip 存档中下载单个文件?
I have a Gradle build which is publishing a zip archive to Artifactory. Some downstream use cases require a single file from the zip artifact, so downloading the entire archive is inefficient. Is it possible to download a single file from within the zip archive?
我怀疑存档的创建方式有问题.如果这是一个线索,我无法通过 Web 查看器扩展 zip 内容.
I suspect an issue in the way the archive is being created.I cannot expand the zip contents through the web viewer, if that is a clue.
这是用于创建 zip 工件的 Gradle 代码:
Here is the Gradle code used to create the zip artifact:
task buildZip(type: Zip) {
description 'Create the ZIP file'
classifier = System.env.CLASSIFIER
extension = 'zip'
def archive_loc = System.env.FOLDER_TO_ZIP
from archive_loc
}
推荐答案
Artifactory 允许使用以下符号从存档(Zip、Jar、War 等)下载特定文件:
Artifactory allows downloading a specific file from an archive (Zip, Jar, War etc.) using the following notation:
http://localhost:8081/artifactory/repo-name/path/to/archive.zip!/path/to/file
有关更多详细信息,请参阅存档条目的文档下载 REST API 方法
For more details see the documentation for the Archive Entry Download REST API method
这篇关于从压缩的 Artifactory 工件下载单个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!