2015-11-16 86 views
5

我試圖按照這些教程(1,2)來實現上述目標。但我還是從Maven的收到此錯誤:如何使用Maven將工件部署到Amazon S3?

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

+0

s3://myrepo.company.solutions/snapshot - 連接被拒絕 - 您確定您使用的IAM用戶具有相關的S3權限嗎?或者您確定所涉及的存儲桶沒有覆蓋IAM策略中允許的權限的存儲桶策略? – mickzer

+0

@mickzer是的,我確定我的IAM用戶有權在該存儲桶中做每件事,而我的存儲桶目前沒有任何政策。 –

回答

4

只是爲了讓你們知道發生了什麼。 問題是我的桶區域是Frankfurt,它需要亞馬遜AWS版本4的最新版本的認證。據我所知,插件aws-maven現在不支持這個新版本。所以解決方案是將我的存儲桶移到另一個支持舊版本方案的區域,如美國標準。現在一切都好了!

+0

到底發生了什麼事。在附註中,您是否構建了使用此私有Maven存儲庫的所有Maven項目?如果是這樣,你在pom.xml中的標籤「repository」下使用了什麼網址?謝謝! –