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. You can use this plugin 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 'software.amazon.awssdk:bom:2.0.0' } }

    If you are testing out the developer preview, add preview-* to the version.

    Note

    You can't use a mix of AWS SDK for Java 2.0 developer preview and non-preview modules in one project.

    dependencyManagement { imports { mavenBom 'software.amazon.awssdk:bom:2.0.0-preview-10' } }
  3. Specify the SDK modules you want to use in the dependencies section.

    dependencies { compile 'software.amazon.awssdk:kinesis' testCompile group: 'junit', name: 'junit', version: '4.11' }

Gradle automatically resolves 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' 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 'software.amazon.awssdk:bom:2.0.0' } } dependencies { compile 'software.amazon.awssdk:kinesis' 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.