Setting up a Gradle project - AWS SDK for Java
AWS services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with AWS services in China.

At Amazon Web Services (AWS), we’re focused on finding ways to improve our products and provide a better customer experience. To do that, we need your feedback. Please take 5 minutes of your time to share insights regarding your experience with Java Spring and your need for Spring integration with AWS.

Click here to take a quick survey

This survey is hosted by an external company (Qualtrics), so the link above does not lead to our website. Please note that AWS will own the data gathered via this survey, and will not share the information/results collected with survey respondents. AWS handles your information as described in the AWS Privacy Notice.

Setting up a Gradle project

You can use Gradle to set up and build AWS SDK for Java projects.

To manage SDK dependencies for your Gradle project, import the Maven bill of materials (BOM) for the AWS SDK for Java into the build.gradle file.

Note

In the following examples, replace 2.15.0 in the build.gradle file with the latest version of the AWS SDK for Java v2. Find the latest version in the AWS SDK for Java API Reference version 2.x.

To configure the AWS SDK for Java for Gradle version 5.0 or later

  1. Add the BOM to the dependencies section of the file.

    ... dependencies { implementation platform('software.amazon.awssdk:bom:2.15.0') // Declare individual SDK dependencies without version ... }
  2. Specify the SDK modules to use in the dependencies section. For example, the following includes a dependency for Amazon Kinesis.

    ... dependencies { ... implementation 'software.amazon.awssdk:kinesis' ... }

Gradle automatically resolves the correct version of your SDK dependencies by using the information from the BOM.

The following is an example of a complete build.gradle file that includes a dependency for Kinesis.

group 'aws.test' version '1.0' apply plugin: 'java' sourceCompatibility = 1.8 repositories { mavenCentral() } dependencies { implementation platform('software.amazon.awssdk:bom:2.15.0') implementation 'software.amazon.awssdk:kinesis' testImplementation group: 'junit', name: 'junit', version: '4.11' }
Note

In the previous example, replace the dependency for Kinesis with the dependencies of the AWS services you will use in your project. The modules (dependencies) that are managed by the AWS SDK for Java BOM are listed on Maven central repository (https://mvnrepository.com/artifact/software.amazon.awssdk/bom/latest).

For more information about specifying SDK dependencies by using the BOM, see Setting up an Apache Maven project.