maven - 如何使用 Maven 将 Artifact 部署到 Amazon S3 中?

标签 maven amazon-web-services amazon-s3 maven-3

我正在尝试按照这些教程( 12 )来实现上述目标。但我仍然从 Maven 收到此错误:

INFO] Installing /home/valter/temp-workspace/document-engine/target/application-1.0.0.CI-SNAPSHOT.jar to /home/valter/.m2/repository/com/company-solutions/application/1.0.0.CI-SNAPSHOT/application-1.0.0.CI-SNAPSHOT.jar
[INFO] Installing /home/valter/temp-workspace/document-engine/pom.xml to /home/valter/.m2/repository/com/company-solutions/application/1.0.0.CI-SNAPSHOT/application-1.0.0.CI-SNAPSHOT.pom
[INFO] 
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ application ---
Downloading: s3://myrepo.company.solutions/snapshot/com/company-solutions/application/1.0.0.CI-SNAPSHOT/maven-metadata.xml
[WARNING] s3://myrepo.company.solutions/snapshot - Connection refused
[WARNING] Could not transfer metadata com.company-solutions:application:1.0.0.CI-SNAPSHOT/maven-metadata.xml from/to s3.snapshot (s3://myrepo.company.solutions/snapshot): Could not connect to repository
[INFO] Logged off - myrepo.company.solutions
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:31 min
[INFO] Finished at: 2015-11-16T18:36:26+01:00
[INFO] Final Memory: 181M/1289M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project application: Failed to retrieve remote metadata com.company-solutions:application:1.0.0.CI-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.company-solutions:application:1.0.0.CI-SNAPSHOT/maven-metadata.xml from/to s3.snapshot (s3://myrepo.company.solutions/snapshot): Could not connect to repository: Status Code: 400, AWS Service: Amazon S3, AWS Request ID: 709B60A05E8E7062, AWS Error Code: InvalidRequest, AWS Error Message: The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

这些是我的本地文件, ~.m2/settings.xml (当然是虚构的值):
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 
      http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <servers>
        <server>
            <id>s3.site</id>
            <username>access_key</username>
            <password>private_key</password>
        </server>
        <server>
            <id>s3.release</id>
            <username>access_key</username>
            <password>private_key</password>
        </server>
        <server>
            <id>s3.snapshot</id>
            <username>access_key</username>
            <password>private_key</password>
        </server>
    </servers>
</settings>

还有我的 pom.xml :
<project>
    <build>
        <extensions>
            <extension>
                <groupId>org.kuali.maven.wagons</groupId>
                <artifactId>maven-s3-wagon</artifactId>
                <version>1.2.1</version>
            </extension>
        </extensions>
        ...
    </build>
    <distributionManagement>
        <site>
            <id>s3.site</id>
            <url>s3://myrepo.company.solutions/site</url>
        </site>
        <repository>
            <id>s3.release</id>
            <url>s3://myrepo.company.solutions/release</url>
        </repository>
        <snapshotRepository>
            <id>s3.snapshot</id>
            <url>s3://myrepo.company.solutions/snapshot</url>
        </snapshotRepository>
    </distributionManagement>
...
</project>

我正在使用 Maven 3.3.3。

编辑
这是我的策略模拟器结果:
enter image description here

最佳答案

只是想让大家知道发生了什么事。
问题是我的桶的区域是 法兰克福 ,这需要来自 Amazon AWS 的最新版本的身份验证,版本 4。据我所知,插件 aws-maven目前不支持这个新版本。所以解决方案是将我的存储桶移动到另一个支持旧版本方案的区域,例如 美标 .现在似乎一切正常!

关于maven - 如何使用 Maven 将 Artifact 部署到 Amazon S3 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33741584/

相关文章:

java - Intellij 和 MAVEN 之间 Junits 的代码覆盖率不匹配

java - maven 。设置 java.library.path

java - 如何为 Servlet 3.0 配置 Spring Boot 1.2.0 并让 m2e 将 Eclipse Facet 设置为 3.0?

amazon-web-services - 使用 golang 的 AWS S3 并行下载

amazon-web-services - 使用 cloudfront 的 s3 上的访问被拒绝错误

javascript - 通过 Jasmine 测试时,RequireJS 模块垫片不起作用

ubuntu - 使用 AWS 用户数据运行 Capistrano 部署任务

amazon-web-services - 无法在ELB中注册EC2实例

amazon-web-services - EC2 SSH 连接自动关闭

amazon-s3 - "s3cmd get"重写本地文件