Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS SDK - very big - 11MB. I want to use only the SimpleDB service

I am using Amazon SimpleDB from a desktop java app. Thus my installer needs to ship the aws-sdk jar as well. The issue is, its 11mB and has a whole lot of classes for services that I will not use.

Is there an easy way of splitting up the sdk into smaller chunks. Like have all the common code into one jar. And all the service specific code into another jar?

Is there something that I could use out of the box? Or do I need to this myself after downloading the code?

I am using the typica library. But its not maintained anymore and is not compatible with the latest httpcomponents.

like image 301
sethu Avatar asked Feb 26 '14 13:02

sethu


1 Answers

I had to work it out with the aws-sdk-code. I excluded a few packages from the pom.xml and the size reduced to 800kb.

<plugin> 
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <source>1.7</source>
    <target>1.7</target>
    <encoding>UTF-8</encoding>
    <excludes>
        <exclude>com/amazonaws/services/autoscaling/**</exclude>
        <exclude>com/amazonaws/services/cloudformation/**</exclude>
        <exclude>com/amazonaws/services/cloudfront/**</exclude>
        <exclude>com/amazonaws/services/cloudfront_2012_03_15/**</exclude>
        <exclude>com/amazonaws/services/cloudsearch/**</exclude>
        <exclude>com/amazonaws/services/cloudtrail/**</exclude>
        <exclude>com/amazonaws/services/cloudwatch/**</exclude>
        <exclude>com/amazonaws/services/datapipeline/**</exclude>
        <exclude>com/amazonaws/services/directconnect/**</exclude>
        <exclude>com/amazonaws/services/dynamodb/**</exclude>
        <exclude>com/amazonaws/services/dynamodbv2/**</exclude>
        <exclude>com/amazonaws/services/ec2/**</exclude>
        <exclude>com/amazonaws/services/elasticache/**</exclude>
        <exclude>com/amazonaws/services/elasticbeanstalk/**</exclude>
        <exclude>com/amazonaws/services/elasticloadbalancing/**</exclude>
        <exclude>com/amazonaws/services/elasticmapreduce/**</exclude>
        <exclude>com/amazonaws/services/elastictranscoder/**</exclude>
        <exclude>com/amazonaws/services/glacier/**</exclude>
        <exclude>com/amazonaws/services/identitymanagement/**</exclude>
        <exclude>com/amazonaws/services/importexport/**</exclude>
        <exclude>com/amazonaws/services/kinesis/**</exclude>
        <exclude>com/amazonaws/services/opsworks/**</exclude>
        <exclude>com/amazonaws/services/rds/**</exclude>
        <exclude>com/amazonaws/services/redshift/**</exclude>
        <exclude>com/amazonaws/services/route53/**</exclude>
        <exclude>com/amazonaws/services/s3/**</exclude>
        <exclude>com/amazonaws/services/securitytoken/**</exclude>
        <exclude>com/amazonaws/services/simpleemail/**</exclude>
        <exclude>com/amazonaws/services/simpleworkflow/**</exclude>
        <exclude>com/amazonaws/services/sns/**</exclude>
        <exclude>com/amazonaws/services/sqs/**</exclude>
        <exclude>com/amazonaws/services/storagegateway/**</exclude>
        <exclude>com/amazonaws/services/support/**</exclude>
        <exclude>com/amazonaws/metrics/**</exclude>
        <exclude>com/amazonaws/auth/policy/resources/SQSQueueResource.java</exclude>
    </excludes>
  </configuration>
</plugin>

Also it needed to 3 dependencies alone for it to work

<properties>
        <jackson.version>2.1.1</jackson.version>
</properties>

 <dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>${jackson.version}</version>
    <type>jar</type>

</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>${jackson.version}</version>
    <type>jar</type>

</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>${jackson.version}</version>
    <type>jar</type>

</dependency>

So in total it came out to less than 2MB. I was using typica and since this was a drop in replacement for it didn't increase my installer size at all.

like image 57
sethu Avatar answered Oct 02 '22 12:10

sethu