并行使用适用于 Java 的 SDK 1.x 和 2.x 版 - AWS SDK for Java 2.x

并行使用适用于 Java 的 SDK 1.x 和 2.x 版

您可以在项目中同时使用适用于 Java 的 AWS SDK 的两个版本。

下面显示了使用版本 1.x 中的 Amazon S3 和版本 2.27.21 中的 DynamoDB 的项目的 pom.xml 文件示例。

例 POM 示例

此示例显示了同时使用 SDK 的 1.x 和 2.x 版本的项目的 pom.xml 文件条目。

<dependencyManagement> <dependencies> <dependency> <groupId>com.amazonaws</groupId> <artifactId>aws-java-sdk-bom</artifactId> <version>1.12.1</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>software.amazon.awssdk</groupId> <artifactId>bom</artifactId> <version>2.27.21</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>com.amazonaws</groupId> <artifactId>aws-java-sdk-s3</artifactId> </dependency> <dependency> <groupId>software.amazon.awssdk</groupId> <artifactId>dynamodb</artifactId> </dependency> </dependencies>