

The AWS SDK for Java 1.x reached end-of-support on December 31, 2025. We recommend that you migrate to the [AWS SDK for Java 2.x](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/home.html) to continue receiving new features, availability improvements, and security updates.

# Use build tools
<a name="setup-build-tools"></a>

The use of build tools helps manage the development of Java projects. Several build tools are available, but we show how to get up and running with two popular build tools--Maven and Gradle. This topic shows you how to use these build tools manage the SDK for Java dependencies that you need for your projects.

**Topics**
+ [

# Use the SDK with Apache Maven
](setup-project-maven.md)
+ [

# Use the SDK with Gradle
](setup-project-gradle.md)

# Use the SDK with Apache Maven
<a name="setup-project-maven"></a>

You can use [Apache Maven](https://maven.apache.org/) to configure and build AWS SDK for Java projects, or to build the SDK itself.

**Note**  
You must have Maven installed to use the guidance in this topic. If it isn’t already installed, visit [http://maven.apache.org/](http://maven.apache.org/) to download and install it.

## Create a new Maven package
<a name="create-a-new-maven-package"></a>

To create a basic Maven package, open a terminal (command-line) window and run:

```
mvn -B archetype:generate \
  -DarchetypeGroupId=org.apache.maven.archetypes \
  -DgroupId=org.example.basicapp \
  -DartifactId=myapp
```

Replace *org.example.basicapp* with the full package namespace of your application, and *myapp* with the name of your project (this will become the name of the directory for your project).

By default, creates a project template for you using the [quickstart](http://maven.apache.org/archetypes/maven-archetype-quickstart/) archetype, which is a good starting place for many projects. There are more archetypes available; visit the [Maven archetypes](https://maven.apache.org/archetypes/index.html) page for a list of archetypes packaged with . You can choose a particular archetype to use by adding the `-DarchetypeArtifactId` argument to the `archetype:generate` command. For example:

```
mvn archetype:generate \
  -DarchetypeGroupId=org.apache.maven.archetypes \
  -DarchetypeArtifactId=maven-archetype-webapp \
  -DgroupId=org.example.webapp \
  -DartifactId=mywebapp
```

**Note**  
Much more information about creating and configuring projects is provided in the [Maven Getting Started Guide](https://maven.apache.org/guides/getting-started/).

## Configure the SDK as a Maven dependency
<a name="configuring-maven"></a>

To use the AWS SDK for Java in your project, you’ll need to declare it as a dependency in your project’s `pom.xml` file. Beginning with version 1.9.0, you can import [individual components](#configuring-maven-individual-components) or the [entire SDK](#configuring-maven-entire-sdk).

### Specifying individual SDK modules
<a name="configuring-maven-individual-components"></a>

To select individual SDK modules, use the AWS SDK for Java bill of materials (BOM) for Maven, which will ensure that the modules you specify use the same version of the SDK and that they’re compatible with each other.

To use the BOM, add a `<dependencyManagement>` section to your application’s `pom.xml` file, adding `aws-java-sdk-bom` as a dependency and specifying the version of the SDK you want to use:

```
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>aws-java-sdk-bom</artifactId>
      <version>1.11.1000</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>
```

To view the latest version of the AWS SDK for Java BOM that is available on Maven Central, visit: [https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-bom](https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-bom). You can also use this page to see which modules (dependencies) are managed by the BOM that you can include within the `<dependencies>` section of your project’s `pom.xml` file.

You can now select individual modules from the SDK that you use in your application. Because you already declared the SDK version in the BOM, you don’t need to specify the version number for each component.

```
<dependencies>
  <dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-java-sdk-s3</artifactId>
  </dependency>
  <dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-java-sdk-dynamodb</artifactId>
  </dependency>
</dependencies>
```

You can also refer to the * AWS Code Sample Catalog * to learn what dependencies to use for a given AWS service. Refer to the POM file under a specific service example. For example, if you are interested in the dependencies for the AWS S3 service, see the [complete example](https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/java/example_code/s3/src/main/java/aws/example/s3/GetAcl.java) on GitHub. (Look at the pom under /java/example\$1code/s3).

### Importing all SDK modules
<a name="configuring-maven-entire-sdk"></a>

If you would like to pull in the *entire* SDK as a dependency, don’t use the BOM method, but simply declare it in your `pom.xml` like this:

```
<dependencies>
  <dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-java-sdk</artifactId>
    <version>1.11.1000</version>
  </dependency>
</dependencies>
```

## Build your project
<a name="build-your-project"></a>

Once you have your project set up, you can build it using Maven’s `package` command:

```
mvn package
```

This will create your `0jar` file in the `target` directory.

## Build the SDK with Maven
<a name="building-with-maven"></a>

You can use Apache Maven to build the SDK from source. To do so, [download the SDK code from GitHub](https://github.com/aws/aws-sdk-java), unpack it locally, and then execute the following Maven command:

```
mvn clean install
```

# Use the SDK with Gradle
<a name="setup-project-gradle"></a>

To manage SDK dependencies for your [Gradle](https://gradle.com/) project, import the Maven BOM for the AWS SDK for Java into the application's `build.gradle` file.

**Note**  
In the following examples, replace *1.12.529* in the build file with a valid version of the AWS SDK for Java. Find the latest version in the [ Maven central repository](https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-bom/latest).

## Project setup for Gradle 4.6 or higher
<a name="project-setup-for-gradle-4-6-or-higher"></a>

 [Since Gradle 4.6](https://docs.gradle.org/4.6/release-notes.html#bom-import), you can use Gradle’s improved POM support feature to import bill of materials (BOM) files by declaring a dependency on a BOM.

1. If you’re using Gradle 5.0 or later, skip to step 2. Otherwise, enable the *IMPROVED\$1POM\$1SUPPORT* feature in the `settings.gradle` file.

   ```
   enableFeaturePreview('IMPROVED_POM_SUPPORT')
   ```

1. Add the BOM to the *dependencies* section of the application's `build.gradle` file.

   ```
   ...
   dependencies {
       implementation platform('com.amazonaws:aws-java-sdk-bom:1.12.529')
   
       // Declare individual SDK dependencies without version
       ...
   }
   ```

1. Specify the SDK modules to use in the *dependencies* section. For example, the following includes a dependency for Amazon Simple Storage Service (Amazon S3).

   ```
   ...
   dependencies {
       implementation platform('com.amazonaws:aws-java-sdk-bom:1.12.529')
       implementation 'com.amazonaws:aws-java-sdk-s3'
       ...
   }
   ```

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 Amazon S3.

```
group 'aws.test'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
  mavenCentral()
}

dependencies {
  implementation platform('com.amazonaws:aws-java-sdk-bom:1.12.529')
  implementation 'com.amazonaws:aws-java-sdk-s3'
}
```

**Note**  
In the previous example, replace the dependency for Amazon S3 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/com.amazonaws/aws-java-sdk-bom/latest).

## Project setup for Gradle versions earlier than 4.6
<a name="project-setup-for-gradle-versions-earlier-than-4-6"></a>

Gradle versions earlier than 4.6 lack native BOM support. To manage AWS SDK for Java dependencies for your project, use Spring’s [dependency management plugin](https://github.com/spring-gradle-plugins/dependency-management-plugin) for Gradle to import the Maven BOM for the SDK.

1. Add the dependency management plugin to your application's `build.gradle` file.

   ```
   buildscript {
       repositories {
           mavenCentral()
       }
       dependencies {
           classpath "io.spring.gradle:dependency-management-plugin:1.0.9.RELEASE"
       }
   }
   
   apply plugin: "io.spring.dependency-management"
   ```

1. Add the BOM to the *dependencyManagement* section of the file.

   ```
   dependencyManagement {
       imports {
           mavenBom 'com.amazonaws:aws-java-sdk-bom:1.12.529'
       }
   }
   ```

1. Specify the SDK modules that you’ll use in the *dependencies* section. For example, the following includes a dependency for Amazon S3.

   ```
   dependencies {
       compile 'com.amazonaws:aws-java-sdk-s3'
   }
   ```

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 Amazon S3.

```
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.9.RELEASE"
  }
}

apply plugin: "io.spring.dependency-management"

dependencyManagement {
  imports {
    mavenBom 'com.amazonaws:aws-java-sdk-bom:1.12.529'
  }
}

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

**Note**  
In the previous example, replace the dependency for Amazon S3 with the dependencies of the AWS service 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/com.amazonaws/aws-java-sdk-bom/latest).

For more information about specifying SDK dependencies by using the BOM, see [Using the SDK with Apache Maven](setup-project-maven.md).