AWS SDK for Java
Developer Guide

Using the SDK with Gradle

To use the AWS SDK for Java in your Gradle project, use Spring's dependency management plugin for Gradle, which can be used to import the SDK's Maven Bill of Materials (BOM) to manage SDK dependencies for your project.

To configure the SDK for Gradle

  1. Add the dependency management plugin to your build.gradle file

    buildscript { repositories { mavenCentral() } dependencies { classpath "io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE" } } apply plugin: "io.spring.dependency-management"
  2. Add the BOM to the dependencyManagement section of the file

    dependencyManagement { imports { mavenBom 'com.amazonaws:aws-java-sdk-bom:1.11.228' } }
  3. Specify the SDK modules that you'll be using in the dependencies section

    dependencies { compile 'com.amazonaws:aws-java-sdk-s3' testCompile group: 'junit', name: 'junit', version: '4.11' }

Gradle will automatically resolve the correct version of your SDK dependencies using the information from the BOM.

Here's the complete build.gradle file:

group 'aws.test' version '1.0-SNAPSHOT' apply plugin: 'java' sourceCompatibility = 1.8 repositories { mavenCentral() } buildscript { repositories { mavenCentral() } dependencies { classpath "io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE" } } apply plugin: "io.spring.dependency-management" dependencyManagement { imports { mavenBom 'com.amazonaws:aws-java-sdk-bom:1.11.228' } } dependencies { compile 'com.amazonaws:aws-java-sdk-s3' testCompile group: 'junit', name: 'junit', version: '4.11' }

Note

For more detail about specifying SDK dependencies using the BOM, see Using the SDK with Apache Maven.