AWS S3 类的 Maven 依赖项

问题描述 投票:0回答:2

有人可以帮助我使用 Maven 和 AWS 吗? 在文档中,他们解释说我们需要添加以下依赖项:

<project>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>software.amazon.awssdk</groupId>
                <artifactId>bom</artifactId>
                <version>2.X.X</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>

我就是这么做的。我想添加依赖项以使用 S3 类(如 AmazonS3Client 等)。在 mavenrepository 中,我找到了包 S3,但是当我将其添加到我的 pom.xml 文件中时,IntelliJ 找不到它。

<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-s3 -->
<dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-java-sdk-s3</artifactId>
    <version>1.11.923</version>
</dependency>

有人可以帮助我并告诉我我所做的事情有什么问题吗?我已经尝试了很多选择,但我无法弄清楚。我想要的只是使用 JAVA 程序中的 S3 对象(基本上是 aws lambda 函数)

amazon-web-services maven amazon-s3 aws-sdk aws-sdk-java-2.0
2个回答
0
投票

如果您想使用AWS SDK for Java 1.x,那么您需要参考 this maven 作为示例。另外,如果您选择适用于 Java 2.x 的 AWS 开发工具包,请使用下面提到的 Maven 依赖项配置并参考 this java 示例。

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>software.amazon.awssdk</groupId>
                <artifactId>bom</artifactId>
                <version>2.15.51</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>s3</artifactId>
        </dependency>
    </dependencies>

0
投票

各位,你们是怎么解决这个问题的?我也有同样的问题!!

© www.soinside.com 2019 - 2024. All rights reserved.