From 35ca62bcc4cce6e31f72f51b04a0794a5be215fe Mon Sep 17 00:00:00 2001 From: Alex Nauda Date: Sat, 17 Jan 2015 21:56:49 -0500 Subject: [PATCH 1/4] added shaded jar build and instructions for use in deploy:deploy-file --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ pom.xml | 21 +++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/README.md b/README.md index 5b274052..64882e76 100644 --- a/README.md +++ b/README.md @@ -172,3 +172,42 @@ aws s3api put-bucket-policy --bucket $BUCKET --policy "$POLICY" [s3]: http://aws.amazon.com/s3/ [sys-prop]: http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/SystemPropertiesCredentialsProvider.html [wagon]: http://maven.apache.org/wagon/ + +## Usage in deploy:deploy-file +If you'd like to use aws-maven via `mvn deploy:deploy-file` to deploy non-maven jars to your s3 maven repo, you might want to install the aws-maven wagon provider and all of its dependencies into your maven installation's lib directory, so that the aws-maven wagon provider is available outside of the context of a project and its pom.xml. Here's one way to do that: + +1. Uncomment the section in this project's pom.xml containing the shaded jar build. + +2. Build this project + + mvn clean package + or if you find that an integration test fails + + mvn -DskipTests=true clean package + +3. Copy the shaded jar into your $MAVEN_HOME/lib + + First, find your maven home: + + $ mvn -v + Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T16:58:10-04:00) + Maven home: /usr/local/Cellar/maven/3.2.3/libexec + Java version: 1.7.0_40, vendor: Oracle Corporation + Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home/jre + Default locale: en_US, platform encoding: UTF-8 + OS name: "mac os x", version: "10.9.5", arch: "x86_64", family: "mac" + + Now copy the shaded jar into your maven home: + + cp target/aws-maven-wagon.jar /usr/local/Cellar/maven/3.2.3/libexec/lib + +4. Deploy your non-maven jar using a deploy:deploy-file command similar to this: + + mvn deploy:deploy-file \ + -Dfile=example.jar \ + -DgroupId=com.example \ + -DartifactId=example \ + -Dversion=1.0.0 \ + -Dpackaging=jar \ + -DrepositoryId=aws-release \ + -Durl=s3:///release diff --git a/pom.xml b/pom.xml index ce78b0f0..ecf8e16b 100644 --- a/pom.xml +++ b/pom.xml @@ -117,6 +117,27 @@ sonar-maven-plugin 2.2 + + From 9a1a9acd83ffddf7c06e423a5740ec9fcc4d7718 Mon Sep 17 00:00:00 2001 From: Benoit Lacelle Solven SARL Date: Thu, 6 Jul 2017 11:42:35 +0200 Subject: [PATCH 2/4] Enable shaded jar through a profile --- pom.xml | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/pom.xml b/pom.xml index ecf8e16b..b74e19a2 100644 --- a/pom.xml +++ b/pom.xml @@ -117,29 +117,35 @@ sonar-maven-plugin 2.2 - - + + + + + shadedWagon + + + + org.apache.maven.plugins + maven-shade-plugin + 3.0.0 + + + package + + shade + + + target/aws-maven-wagon.jar + + + + + + + + https://github.com/spring-projects/aws-maven From b7acf3b9b45d9d82ea3bff77b7d1f4942112c0e8 Mon Sep 17 00:00:00 2001 From: Benoit Lacelle Solven SARL Date: Thu, 6 Jul 2017 11:43:26 +0200 Subject: [PATCH 3/4] Update README about profile for shaded jar --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 64882e76..3f8a89c0 100644 --- a/README.md +++ b/README.md @@ -176,14 +176,12 @@ aws s3api put-bucket-policy --bucket $BUCKET --policy "$POLICY" ## Usage in deploy:deploy-file If you'd like to use aws-maven via `mvn deploy:deploy-file` to deploy non-maven jars to your s3 maven repo, you might want to install the aws-maven wagon provider and all of its dependencies into your maven installation's lib directory, so that the aws-maven wagon provider is available outside of the context of a project and its pom.xml. Here's one way to do that: -1. Uncomment the section in this project's pom.xml containing the shaded jar build. +1. Build this project -2. Build this project - - mvn clean package + mvn clean package -PshadedWagon or if you find that an integration test fails - mvn -DskipTests=true clean package + mvn -DskipTests=true clean package -PshadedWagon 3. Copy the shaded jar into your $MAVEN_HOME/lib From 11f258977be4c76254dbe4a9e63b93a6c71ad0c5 Mon Sep 17 00:00:00 2001 From: Alex Nauda Date: Sun, 15 Oct 2017 02:49:19 -0400 Subject: [PATCH 4/4] support aws default credential provider chain --- .../AuthenticationInfoAWSCredentialsProviderChain.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/springframework/build/aws/maven/AuthenticationInfoAWSCredentialsProviderChain.java b/src/main/java/org/springframework/build/aws/maven/AuthenticationInfoAWSCredentialsProviderChain.java index 86726039..2b337f14 100644 --- a/src/main/java/org/springframework/build/aws/maven/AuthenticationInfoAWSCredentialsProviderChain.java +++ b/src/main/java/org/springframework/build/aws/maven/AuthenticationInfoAWSCredentialsProviderChain.java @@ -17,17 +17,13 @@ package org.springframework.build.aws.maven; import com.amazonaws.auth.AWSCredentialsProviderChain; -import com.amazonaws.auth.EnvironmentVariableCredentialsProvider; -import com.amazonaws.auth.InstanceProfileCredentialsProvider; -import com.amazonaws.auth.SystemPropertiesCredentialsProvider; +import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; import org.apache.maven.wagon.authentication.AuthenticationInfo; final class AuthenticationInfoAWSCredentialsProviderChain extends AWSCredentialsProviderChain { AuthenticationInfoAWSCredentialsProviderChain(AuthenticationInfo authenticationInfo) { - super(new EnvironmentVariableCredentialsProvider(), - new SystemPropertiesCredentialsProvider(), - new InstanceProfileCredentialsProvider(), + super(new DefaultAWSCredentialsProviderChain(), new AuthenticationInfoAWSCredentialsProvider(authenticationInfo)); } }