如何在 IntelliJ 中使用 Gradle 设置 Amazon Polly SDK

How to setup Amazon Polly SDK with Gradle in IntetlliJ

我正在尝试按照 this 在 IntelliJ 中使用 Gradle 设置 AWS Polly Java SDK。我已经使用 spring intializr 创建了一个简单的 Spring 引导应用程序,因此我将教程中指定的项目添加到我的 build.gradle 文件中。尝试导入时

import com.amazonaws.services.polly.AmazonPollyClient

IntelliJ 无法解析名称 polly

这是我的完整 build.gradle 文件

buildscript {
    ext {
        springBootVersion = '2.0.4.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        classpath "io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE"
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'io.ai.vivid'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

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

dependencies {
    compile('org.springframework.boot:spring-boot-starter')
    testCompile('org.springframework.boot:spring-boot-starter-test')
    compile 'com.amazonaws:aws-java-sdk-s3'
    testCompile group: 'junit', name: 'junit', version: '4.11'
}

IntelliJ 也抱怨它无法解析我的 build.gradle 中的名称 manvenBom。我已经尝试过像 invalidate cache/restart 这样的 SO 解决方案,但无法解决问题。

我使用你的 build.gradle 文件重现了这个问题,并且在对 dependencies

进行了以下更改后能够导入 AmazonPollyClient
dependencies {
compile 'com.amazonaws:aws-java-sdk-s3'
compile group: 'com.amazonaws', name: 'aws-java-sdk-polly', version: '1.11.67'

Gradle版本使用4.8