Migrate from the AWS SDK for Java v1 to the AWS SDK for Java v2

Apache 2.0

This recipe will apply changes required for migrating from the AWS SDK for Java v1 to the AWS SDK for Java v2.

software.amazon.awssdk.v2migration.AwsSdkJavaV1ToV2
mod run . --recipe=software.amazon.awssdk.v2migration.AwsSdkJavaV1ToV2

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Add AWS SDK for Java v2 S3 Transfer Manager dependency if needed
  2. Add AWS SDK for Java v2 S3 Event Notification dependency if needed
  3. Change v1 Maven/Gradle dependencies to v2
  4. Add imports and comments to unsupported S3 transforms.
  5. S3 Event Notification method to v2
  6. Change S3 types to v2.
  7. V1 S3Object to V2
  8. V1 S3 streaming requests to V2
  9. V1 S3 non-streaming requests to V2
  10. Change S3 methods to v2.
  11. Change S3EventNotification methods to v2.
  12. S3 POJOs to V2
  13. Change S3 method constructors to fluent builder calls
  14. Convert v1 AmazonS3URI to v2 S3Uri
  15. Change v1 enum getters to v2
  16. Change SDK TransferManager types from v1 to v2
  17. Change SDK S3EventNotification types from v1 to v2
  18. Change AWS SDK for Java v1 types to v2 equivalents
  19. SDK Exceptions Methods to V2
  20. Change SDK core types from v1 to v2
  21. V1 client builder variations to builder()
  22. Change new objects creation to Builder pattern
  23. Transform 'new' expressions to static factory methods
  24. V1 Getter to V2
  25. Move HTTP settings from the ClientOverrideConfiguration to ApacheHttpClient for sync and NettyNioAsyncHttpClient for async
  26. Wrap the region string provided on the SDK client builder with Region.of
  27. V1 Enum Casing to V2
  28. Convert SdkBytes to ByteBuffer
  29. Convert ByteBuffer to SdkBytes
  30. Convert Date to Instant
  31. V1 S3 non-streaming requests to V2
  32. V1 S3 PutObjectRequest, AmazonS3.putObject(PutObjectRequest), and TransferManager.upload(PutObjectRequest) to V2
  33. Convert V1 setters to V2 toBuilder setters
  34. Add imports and comments to unsupported S3 transfer manager transforms.
  35. Change TransferManager simple methods to v2.
  36. Transfer Manager Methods to V2