jcaddel / maven-s3-wagon

Multi-threaded wagon to connect Maven with Amazon S3
123 stars 50 forks source link

Allow overriding the endpoint used with the maven.wagon.s3.endpoint property #28

Closed ankon closed 1 year ago

ankon commented 7 years ago

I've used this (together with the update of the AWS SDK in #27) to deploy to Minio (https://github.com/minio/minio).

jamshid commented 7 years ago

Hi @ankon sorry to bug you but I would also like to use maven-s3-wagon with a S3-compatible system, so your endpoint enhancement is exactly what I need. Should mvn package work? I cannot figure out where EXPIRATION_EPOCH is coming from.

I guess even after getting it built I'll have a problem that this custom plugin would have to be deployed to an existing (non-S3) repo in order to use it?

bash-4.2# mvn package
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven S3 Wagon 1.2.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> spring-maven-plugin:3.1.0:load (project-augment) > :load @ maven-s3-wagon >>>
[INFO] 
[INFO] <<< spring-maven-plugin:3.1.0:load (project-augment) < :load @ maven-s3-wagon <<<
[INFO] 
[INFO] --- spring-maven-plugin:3.1.0:load (project-augment) @ maven-s3-wagon ---
[INFO] Forced mojo execution
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.003 s
[INFO] Finished at: 2017-06-11T17:21:25+00:00
[INFO] Final Memory: 16M/240M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.kuali.maven.plugins:spring-maven-plugin:3.1.0:load (project-augment) on project maven-s3-wagon: Execution project-augment of goal org.kuali.maven.plugins:spring-maven-plugin:3.1.0:load failed: Error creating bean with name 'getExecutable' defined in class org.kuali.maven.plugins.spring.config.MojoExecutableConfig: Invocation of init method failed; nested exception is java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException: Error creating bean with name 'projectPropertySource' defined in class org.kuali.common.util.spring.ProjectPropertySourceConfig: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.core.env.PropertiesPropertySource org.kuali.common.util.spring.ProjectPropertySourceConfig.projectPropertySource()] threw exception; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'EXPIRATION_EPOCH' in string value "() {  EXPIRATION_EPOCH=$(tail -1 /create-token.cookies | awk '{print $5}' || echo +$(expr 60 "*" 60 "*" 24 "*" 90));
[ERROR] ( set -x;
[ERROR] s3cmd signurl "$1" ${EXPIRATION_EPOCH} ) && return 0;
[ERROR] status=$?;
[ERROR] echo "Run: 'signurl s3://private/readme.txt' to get signed url that expires when token expires.";
[ERROR] return $status
[ERROR] }"
[ERROR] -> [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/PluginExecutionException
jamshid commented 7 years ago

Nevermind @ankon, got mvn install to work with below pom.xml changes. I guess if I knew maven I'd understand why the <parent> element has to be removed when building someone else's project. Also, like you said had to update the AWS Java SDK version from 1.6.4 to avoid:

[ERROR] /maven-s3-wagon/src/main/java/org/kuali/maven/wagon/S3Wagon.java:[195,66] cannot find symbol
[ERROR] symbol:   method builder()
[ERROR] location: class com.amazonaws.services.s3.S3ClientOptions

Do you happen to know how to set the maven.wagon.s3.endpoint property in ~/.m2/settings.xml, so there's one place to edit along with access and secret keys? Searching for "where to put system properties for a maven plugin" is an adventure. I'm trying to avoid command-line mvn -Dmaven.wagon.s3.endpoint=https://s3storage.example.com deploy, though glad that works!

diff --git a/pom.xml b/pom.xml
index 1e12a70..d798ff1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,11 +17,13 @@
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http
   <modelVersion>4.0.0</modelVersion>
+<!--
   <parent>
     <groupId>org.kuali.pom</groupId>
     <artifactId>kuali-common</artifactId>
     <version>3.4.2</version>
   </parent>
+-->
   <groupId>org.kuali.maven.wagons</groupId>
   <artifactId>maven-s3-wagon</artifactId>
   <version>1.2.2-SNAPSHOT</version>
@@ -37,7 +39,7 @@
     <project.scm.vendor>git</project.scm.vendor>
     <project.java.version>1.5</project.java.version>
     <slf4j.version>1.7.5</slf4j.version>
-    <aws.version>1.6.4</aws.version>
+    <aws.version>1.11.145</aws.version>
     <spring.version>3.2.5.RELEASE</spring.version>
     <kuali-s3.version>1.0.1</kuali-s3.version>
     <junit.version>4.11</junit.version>
ankon commented 7 years ago

You can set system properties via the MAVEN_OPTS environment variable, or via .mvn/jvm.config in the project directory (see 'JVM and Command Line Options' on https://maven.apache.org/docs/3.3.1/release-notes.html for details)