gpt4 book ai didi

java - 如何在 Eclipse 中导入 com.google.cloud.datastore?

转载 作者:行者123 更新时间:2023-12-02 02:57:34 24 4
gpt4 key购买 nike

我正在测试来自 google 的一些示例,但收到此错误“无法解析导入 com.google.cloud.datastore”。如何在 Eclipse 中正确导入 com.google.datastore.*?我正在读这篇文章http://googlecloudplatform.github.io/google-cloud-java/0.10.0/index.html但仍然不工作。(我已经在 Eclipse 上安装了谷歌云,其他东西正在运行,比如 hello 应用程序)。谢谢

最佳答案

您需要将 Google Cloud Datastore 客户端库的依赖项添加到 pom.xml 中。有一个<dependencies>部分,在那里添加:

<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud</artifactId>
<version>0.10.0-alpha</version>
</dependency>

(上面的代码片段位于您链接的页面的顶部)。保存后,M2Eclipse 应该下载数据存储 jar 并将其添加到项目的类路径中,然后 import com.google.datastore.*应该可以。

这应该将数据存储 jar 添加到项目的 Maven 依赖项中: Maven dependencies

如果你深入研究它,你应该会看到 com.google.cloud.datastore.Datastore那里的类(class):

enter image description here

关于java - 如何在 Eclipse 中导入 com.google.cloud.datastore?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42856849/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com