简体   繁体   English

在 AWS SDK for Java v2 上添加 Gradle 依赖项

[英]Adding a Gradle dependency on AWS SDK for Java v2

I'd like to add the latest AWS SDK for Java v2 to my project's Gradle dependencies.我想将最新的 AWS SDK for Java v2 添加到我项目的 Gradle 依赖项中。 In my case I'd like to add a dependency for software.amazon.awssdk:core .就我而言,我想为software.amazon.awssdk:core添加一个依赖项。 According to the docs I need to add these lines to the dependencies block:根据文档,我需要将这些行添加到dependencies块:

  implementation platform('software.amazon.awssdk:bom:2.10.86')
  implementation 'software.amazon.awssdk:core'

However, this gives me:但是,这给了我:

Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find software.amazon.awssdk:core:.
     Required by:
         project :

When I make the version number for the core artifact explicit, the build works.当我明确核心工件的版本号时,构建工作。 But this defeats the point of importing a BOM via the platform directive.但这违背了通过平台指令导入 BOM 的意义。

I did find this post but as far as I understand Gradle, I am already adding the platform to the implementation configuration when I follow the Amazon docs.我确实找到了这篇文章,但据我了解 Gradle,当我遵循 Amazon 文档时,我已经将平台添加到implementation配置中。

Currently I am using Gradle 5.6.3.目前我正在使用 Gradle 5.6.3。 Any hints on making this work are appreciated.任何有关使这项工作的提示表示赞赏。

@SGM1 pointed me in the right direction. @SGM1 为我指明了正确的方向。 The following works:以下工作:

implementation platform('software.amazon.awssdk:bom:2.10.86') 
implementation 'software.amazon.awssdk:aws-core'

Obviously, the import statements need to be changed to software.amazon.awssdk.(etc) .显然,导入语句需要更改为software.amazon.awssdk.(etc)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM