Skip to content

Commit

Permalink
Add ant config for uploading to S3
Browse files Browse the repository at this point in the history
  • Loading branch information
dsyer committed Mar 21, 2011
1 parent f3d39db commit 4d8161c
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 10 deletions.
60 changes: 50 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,16 @@
</license>
</licenses>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<dependency.locations.enabled>false</dependency.locations.enabled>
<dist.id>spring-batch</dist.id>
<dist.name>Spring Batch</dist.name>
<dist.key>BATCH</dist.key>
<dist.version>${project.version}</dist.version>
<dist.finalName>${dist.id}-${dist.version}-no-dependencies</dist.finalName>
<dist.fileName>${dist.finalName}.zip</dist.fileName>
<dist.filePath>target/${dist.fileName}</dist.filePath>
<dist.bucketName>dist.springframework.org</dist.bucketName>
</properties>
<profiles>
<profile>
Expand Down Expand Up @@ -215,6 +224,20 @@
<goal>run</goal>
</goals>
</execution>
<execution>
<id>upload-dist</id>
<phase>deploy</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<ant antfile="${basedir}/src/ant/upload-dist.xml">
<target name="upload-dist" />
</ant>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down Expand Up @@ -322,6 +345,9 @@
</profile>
<profile>
<id>staging</id>
<properties>
<dist.staging>/${user.dir}/target/staging/dist</dist.staging>
</properties>
<distributionManagement>
<site>
<id>staging</id>
Expand All @@ -346,6 +372,9 @@
</configuration>
</plugin>
</plugins>
<!-- the name of this project is 'spring-amqp-dist';
make sure the zip file is just 'spring-amqp'. -->
<finalName>${dist.finalName}</finalName>
</build>
</profile>
<profile>
Expand Down Expand Up @@ -405,17 +434,28 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-apache-regexp</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>org.springframework.build</groupId>
<artifactId>org.springframework.build.aws.ant</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>net.java.dev.jets3t</groupId>
<artifactId>jets3t</artifactId>
<version>0.7.2</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-apache-regexp</artifactId>
<version>1.7.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
Expand Down
65 changes: 65 additions & 0 deletions src/ant/upload-dist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0"?>
<project name="upload-dist-tasks">

<!-- can be run independent of maven as follows (but it's easier
to simply use "mvn antrun:run"):
- classpath must be uncommented below. when run from maven,
- the classpath is set up for you
ant -f src/ant/upload-dist.xml \
-Ddist.id=spring-batch \
-Ddist.name='Spring Batch' \
-Ddist.key=BATCH \
-Ddist.accessKey=<access key> \
-Ddist.secretKey=<secret key> \
-Ddist.bucketName=dist.springframework.org \
-Ddist.fileName=spring-batch-1.0.0.M1.zip \
-Ddist.filePath=target/spring-batch-1.0.0.M1.zip \
-Ddist.version=1.0.0.M1 \
upload-dist
-->

<taskdef resource="org/springframework/build/aws/ant/antlib.xml">
<!-- see comment above
<classpath>
<pathelement location="/Users/cbeams/Desktop/org.springframework.build.aws.ant-3.0.5.RELEASE.jar"/>
<pathelement location="/Users/cbeams/.m2/repository/net/java/dev/jets3t/jets3t/0.7.2/jets3t-0.7.2.jar"/>
<pathelement location="/Users/cbeams/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar"/>
<pathelement location="/Users/cbeams/.m2/repository/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar"/>
<pathelement location="/Users/cbeams/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar"/>
</classpath>
-->
</taskdef>
<target name="upload-dist" depends="upload-prep,upload-s3,upload-staging"/>
<target name="upload-prep">
<condition property="dist.releaseType" value="snapshot">
<contains string="${dist.version}" substring="snapshot" casesensitive="false"/>
</condition>
<condition property="dist.releaseType" value="release" else="milestone">
<contains string="${dist.version}" substring="release" casesensitive="false"/>
</condition>
</target>
<target name="upload-s3" unless="dist.staging">
<checksum file="${dist.filePath}" algorithm="sha1"/>
<s3 accessKey="${dist.accessKey}" secretKey="${dist.secretKey}">
<upload bucketName="${dist.bucketName}" file="${dist.filePath}"
toFile="${dist.releaseType}/${dist.key}/${dist.fileName}" publicRead="true">
<metadata name="project.name" value="${dist.name}"/>
<metadata name="release.type" value="${dist.releaseType}"/>
<metadata name="bundle.version" value="${dist.version}"/>
<metadata name="package.file.name" value="${dist.fileName}"/>
</upload>
<upload bucketName="${dist.bucketName}" file="${dist.filePath}.sha1"
toFile="${dist.releaseType}/${dist.key}/${dist.fileName}.sha1" publicRead="true">
</upload>
</s3>
</target>
<target name="upload-staging" if="dist.staging">
<echo>Copying dist .ZIP to ${dist.staging}</echo>
<checksum file="${dist.filePath}" algorithm="sha1"/>
<copy file="${dist.filePath}.sha1"
toFile="${dist.staging}/${dist.key}/${dist.fileName}.sha1"/>
<copy file="${dist.filePath}"
toFile="${dist.staging}/${dist.key}/${dist.fileName}"/>
</target>
</project>

0 comments on commit 4d8161c

Please sign in to comment.