Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

Error: "The specified key does not exist" when passing S3 prefix as the only value of <keys> field. #74

Open
desmond27 opened this issue Feb 17, 2020 · 1 comment

Comments

@desmond27
Copy link

When I pass the S3 prefix of the objects that I want downloaded before packaging, I get the following error:

Failed to execute goal com.gkatzioura.maven.cloud:s3-storage-wagon:2.3:s3-download (download-multiple-files-to-one-directory) on project TestProject: Execution download-multiple-files-to-one-directory of goal com.gkatzioura.maven.cloud:s3-storage-wagon:2.3:s3-download failed: The specified key does not exist. (Service: Amazon S3; Status Code: 404; Error Code: NoSuchKey; Request ID: REDACTED; S3 Extended Request ID: REDACTED) -> [Help 1]

The execution config is as follows:

<execution>
    <id>download-multiple-files-to-one-directory</id>
    <phase>prepare-package</phase>
    <goals>
        <goal>s3-download</goal>
    </goals>
    <configuration>
        <bucket>plugins-bucket</bucket>
        <downloadPath>WebContent\WEB-INF</downloadPath>
        <keys>Plugins</keys>
    </configuration>
</execution>

Going through the code in S3DownloadMojo.java I have come across the following lines:

if (keys.size()==1) {
    downloadSingleFile(amazonS3,keys.get(0));
    return;
}

Here downloadSingleFile() is set to only download a single file if the number of keys given is one. Could this be enhanced to recursively fetch all objects under the given prefix via another configuration parameter?

@steven93921
Copy link

I agree this is needed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants