bugix and name refactor
diff --git a/README.txt b/README.txt
index 1a291b8..e4caf63 100644
--- a/README.txt
+++ b/README.txt
@@ -4,10 +4,22 @@
THIS PROJECT IS A FORKED VERSION OF THE SPRING PROJECT git://git.springsource.org/spring-build/aws-maven.git
-The main works is come from Spring version.
+The main works is come from Spring version. All the credit is theirs. Thank you.
Master branch is the original Spring branch from git://git.springsource.org/spring-build/aws-maven.git
Anzix branch is my developmebt branch.
For usage see: http://blog.anzix.net/2010/12/07/using-amazon-s3-as-a-maven-repository/ (it's about the Spring version)
+
+
+CHANGE LOG:
+
+3.2
+
++ Google Developer Storage support (use s3://bucket_name@commondatastorage.googleapis.com/prefix)
++ support for root repository (s3://bucket_name@provider without any prefix)
++ remove spring repositories (jets3t is in the centreal)
++ update jets3t version to 8.0
++ support both passphrase and password tag in settings.xml / server
++ improved error messages
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 45f2521..f1376b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,16 +3,35 @@
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
<modelVersion>4.0.0</modelVersion>
- <groupId>net.anzix</groupId>
- <artifactId>org.springframework.build.aws.maven</artifactId>
+ <groupId>net.anzix.aws</groupId>
+ <artifactId>s3-maven-wagon</artifactId>
<packaging>jar</packaging>
<name>Amazon S3/Google Developer Storage Maven Wagon Support</name>
- <version>3.1.2-SNAPSHOT</version>
- <description>Standard Maven wagon support for s3:// urls</description>
- <url>http://www.springframework.org</url>
+ <version>3.2-SNAPSHOT</version>
+ <description>Standard Maven wagon support for s3:// urls (forked from the Spring version)</description>
+ <url>https://github.com/elek/s3-maven-wagon/admin</url>
<inceptionYear>2007</inceptionYear>
+ <parent>
+ <groupId>org.sonatype.oss</groupId>
+ <artifactId>oss-parent</artifactId>
+ <version>5</version>
+ </parent>
+ <developers>
+ <developer>
+ <name>Spring team</name>
+ <organization>Spring source</organization>
+ <roles>
+ <role>author</role>
+ </roles>
+ </developer>
+ <developer>
+ <name>Elek, Márton</name>
+ <roles>
+ <role>small modifications on this fork</role>
+ </roles>
+ </developer>
+ </developers>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
@@ -21,12 +40,9 @@
</license>
</licenses>
<scm>
- <connection>scm:git:git://git.springsource.org/spring-build/aws-maven.git</connection>
+ <connection>scm:git:git://git@github.com:elek/s3-maven-wagon.git</connection>
+ <url>scm:git:git://git@github.com:elek/s3-maven-wagon.git</url>
</scm>
- <organization>
- <name>Spring Framework</name>
- <url>http://www.springframework.org</url>
- </organization>
<build>
<extensions>
<extension>
@@ -44,8 +60,31 @@
<target>1.5</target>
</configuration>
</plugin>
+
</plugins>
</build>
+ <profiles>
+ <profile>
+ <id>release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
<dependencies>
<dependency>
<groupId>commons-httpclient</groupId>
diff --git a/src/main/java/org/springframework/aws/maven/AbstractWagon.java b/src/main/java/net/anzix/aws/maven/AbstractWagon.java
similarity index 99%
rename from src/main/java/org/springframework/aws/maven/AbstractWagon.java
rename to src/main/java/net/anzix/aws/maven/AbstractWagon.java
index e806b94..d190cae 100644
--- a/src/main/java/org/springframework/aws/maven/AbstractWagon.java
+++ b/src/main/java/net/anzix/aws/maven/AbstractWagon.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.aws.maven;
+package net.anzix.aws.maven;
import org.apache.maven.wagon.ConnectionException;
import org.apache.maven.wagon.ResourceDoesNotExistException;
diff --git a/src/main/java/org/springframework/aws/maven/SessionListenerSupport.java b/src/main/java/net/anzix/aws/maven/SessionListenerSupport.java
similarity index 98%
rename from src/main/java/org/springframework/aws/maven/SessionListenerSupport.java
rename to src/main/java/net/anzix/aws/maven/SessionListenerSupport.java
index a3e481f..ce08ab7 100644
--- a/src/main/java/org/springframework/aws/maven/SessionListenerSupport.java
+++ b/src/main/java/net/anzix/aws/maven/SessionListenerSupport.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.aws.maven;
+package net.anzix.aws.maven;
import java.util.HashSet;
import java.util.Set;
diff --git a/src/main/java/org/springframework/aws/maven/SimpleStorageServiceWagon.java b/src/main/java/net/anzix/aws/maven/SimpleStorageServiceWagon.java
similarity index 90%
rename from src/main/java/org/springframework/aws/maven/SimpleStorageServiceWagon.java
rename to src/main/java/net/anzix/aws/maven/SimpleStorageServiceWagon.java
index 2a3c942..6fbcff6 100644
--- a/src/main/java/org/springframework/aws/maven/SimpleStorageServiceWagon.java
+++ b/src/main/java/net/anzix/aws/maven/SimpleStorageServiceWagon.java
@@ -13,17 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.aws.maven;
+package net.anzix.aws.maven;
import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.apache.maven.wagon.authentication.AuthenticationException;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.proxy.ProxyInfoProvider;
import org.apache.maven.wagon.repository.Repository;
-import org.jets3t.service.S3ServiceException;
import org.jets3t.service.acl.AccessControlList;
import org.jets3t.service.impl.rest.httpclient.RestS3Service;
-import org.jets3t.service.model.S3Object;
import org.jets3t.service.security.AWSCredentials;
import java.io.File;
@@ -39,7 +37,7 @@
import org.jets3t.service.impl.rest.httpclient.RestStorageService;
import org.jets3t.service.model.StorageObject;
import org.jets3t.service.security.GSCredentials;
-import org.jets3t.service.security.ProviderCredentials;
+
/**
* An implementation of the Maven Wagon interface that allows you to access the
@@ -71,16 +69,20 @@
protected void connectToRepository(Repository source, AuthenticationInfo authenticationInfo, ProxyInfoProvider proxyInfoProvider)
throws AuthenticationException {
try {
+ String provider = null;
bucket = source.getUsername();
- String provider = source.getHost();
- if (provider == null) {
+ if (bucket == null || "".equals(bucket)) {
+ bucket = source.getHost();
provider = AMAZON_URL;
+ } else {
+ provider = source.getHost();
}
+
Credentials c = getCredentials(authenticationInfo);
if (AMAZON_URL.equals(provider)) {
service = new RestS3Service(new AWSCredentials(c.access, c.secret));
} else if (GOOGLE_URL.equals(provider)) {
- service = new GoogleStorageService(new GSCredentials(c.access,c.secret));
+ service = new GoogleStorageService(new GSCredentials(c.access, c.secret));
} else {
throw new IllegalArgumentException("Private Clouds not supported yet. Use s3://bucketname@" + AMAZON_URL + " or s3://bucketname@" + GOOGLE_URL);
}
@@ -88,7 +90,6 @@
} catch (ServiceException e) {
throw new AuthenticationException("Cannot authenticate with current credentials", e);
}
- bucket = source.getUsername();
basedir = getBaseDir(source);
}
@@ -163,7 +164,7 @@
protected void putResource(File source, String destination, TransferProgress progress) throws ServiceException,
IOException {
buildDestinationPath(getDestinationPath(destination));
- S3Object object = new S3Object(basedir + destination);
+ StorageObject object = new StorageObject(basedir + destination);
object.setAcl(AccessControlList.REST_CANNED_PUBLIC_READ);
object.setDataInputFile(source);
object.setContentLength(source.length());
@@ -190,7 +191,7 @@
}
private void buildDestinationPath(String destination) throws ServiceException {
- S3Object object = new S3Object(basedir + destination + "/");
+ StorageObject object = new StorageObject(basedir + destination + "/");
object.setAcl(AccessControlList.REST_CANNED_PUBLIC_READ);
object.setContentLength(0);
service.putObject(bucket, object);
@@ -207,7 +208,7 @@
private String getBaseDir(Repository source) {
StringBuilder sb = new StringBuilder(source.getBasedir());
sb.deleteCharAt(0);
- if (sb.length()>0 && sb.charAt(sb.length() - 1) != '/') {
+ if (sb.length() > 0 && sb.charAt(sb.length() - 1) != '/') {
sb.append('/');
}
return sb.toString();
@@ -215,18 +216,19 @@
private Credentials getCredentials(AuthenticationInfo authenticationInfo) throws AuthenticationException {
if (authenticationInfo == null) {
- String example = "<server>\n"+
- " <id>repo_key</id>\n"+
- " <username>access_key</username>\n"+
- " <password>secret_key</password>\n"+
- "</server>";
- throw new AuthenticationException("Missing authentication info. Add a \n"+example+"\n to your settings.xml!");
+ String example = "<server>\n"
+ + " <id>repo_key</id>\n"
+ + " <username>access_key</username>\n"
+ + " <password>secret_key</password>\n"
+ + "</server>";
+ throw new AuthenticationException("Missing authentication info. Add a \n" + example + "\n to your settings.xml!");
}
String accessKey = authenticationInfo.getUserName();
String secretKey = authenticationInfo.getPassphrase();
- if ("".equals(secretKey)){
+ if ("".equals(secretKey)) {
throw new AuthenticationException("With maven3 you should encrypt the secretKey (see http://maven.apache.org/guides/mini/guide-encryption.html) or use the password field.");
- } if (secretKey == null) {
+ }
+ if (secretKey == null) {
secretKey = authenticationInfo.getPassword();
}
@@ -246,6 +248,5 @@
this.access = access;
this.secret = secret;
}
-
}
}
diff --git a/src/main/java/org/springframework/aws/maven/TransferListenerSupport.java b/src/main/java/net/anzix/aws/maven/TransferListenerSupport.java
similarity index 98%
rename from src/main/java/org/springframework/aws/maven/TransferListenerSupport.java
rename to src/main/java/net/anzix/aws/maven/TransferListenerSupport.java
index ef6c143..909b9dc 100644
--- a/src/main/java/org/springframework/aws/maven/TransferListenerSupport.java
+++ b/src/main/java/net/anzix/aws/maven/TransferListenerSupport.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.aws.maven;
+package net.anzix.aws.maven;
import java.util.HashSet;
import java.util.Set;
diff --git a/src/main/java/org/springframework/aws/maven/TransferProgress.java b/src/main/java/net/anzix/aws/maven/TransferProgress.java
similarity index 96%
rename from src/main/java/org/springframework/aws/maven/TransferProgress.java
rename to src/main/java/net/anzix/aws/maven/TransferProgress.java
index e1ebece..b836c1a 100644
--- a/src/main/java/org/springframework/aws/maven/TransferProgress.java
+++ b/src/main/java/net/anzix/aws/maven/TransferProgress.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.aws.maven;
+package net.anzix.aws.maven;
import org.apache.maven.wagon.resource.Resource;
diff --git a/src/main/java/org/springframework/aws/maven/TransferProgressFileInputStream.java b/src/main/java/net/anzix/aws/maven/TransferProgressFileInputStream.java
similarity index 97%
rename from src/main/java/org/springframework/aws/maven/TransferProgressFileInputStream.java
rename to src/main/java/net/anzix/aws/maven/TransferProgressFileInputStream.java
index 438bb51..08ec357 100644
--- a/src/main/java/org/springframework/aws/maven/TransferProgressFileInputStream.java
+++ b/src/main/java/net/anzix/aws/maven/TransferProgressFileInputStream.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.aws.maven;
+package net.anzix.aws.maven;
import java.io.File;
import java.io.FileInputStream;
diff --git a/src/main/java/org/springframework/aws/maven/TransferProgressFileOutputStream.java b/src/main/java/net/anzix/aws/maven/TransferProgressFileOutputStream.java
similarity index 97%
rename from src/main/java/org/springframework/aws/maven/TransferProgressFileOutputStream.java
rename to src/main/java/net/anzix/aws/maven/TransferProgressFileOutputStream.java
index 73815e3..4055089 100644
--- a/src/main/java/org/springframework/aws/maven/TransferProgressFileOutputStream.java
+++ b/src/main/java/net/anzix/aws/maven/TransferProgressFileOutputStream.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.aws.maven;
+package net.anzix.aws.maven;
import java.io.File;
import java.io.FileNotFoundException;
diff --git a/src/main/resources/META-INF/plexus/components.xml b/src/main/resources/META-INF/plexus/components.xml
index 1373d4d..42e9215 100644
--- a/src/main/resources/META-INF/plexus/components.xml
+++ b/src/main/resources/META-INF/plexus/components.xml
@@ -3,7 +3,7 @@
<component>
<role>org.apache.maven.wagon.Wagon</role>
<role-hint>s3</role-hint>
- <implementation>org.springframework.aws.maven.SimpleStorageServiceWagon</implementation>
+ <implementation>net.anzix.aws.maven.SimpleStorageServiceWagon</implementation>
<instantiation-strategy>per-lookup</instantiation-strategy>
</component>
</components>