Search code examples
gradleartifactory

Download single file from zipped Artifactory artifact


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?

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.

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
}

Solution

  • 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
    

    For more details see the documentation for the Archive Entry Download REST API method