gpt4 book ai didi

java - 为什么我将 ORG.mongodb.smth 添加到依赖项中,然后导入 COM.mongodb.smth?

转载 作者:行者123 更新时间:2023-12-01 13:50:27 28 4
gpt4 key购买 nike

我是在 Scala/SBT 项目的代码中执行此操作,但我认为这个问题同样适用于 Java 代码。

build.sbt中我有:

libraryDependencies += "org.mongodb" %% "casbah" % "2.6.3"

但是在代码中,我需要导入例如:

import com.mongodb.MongoClient

我会尝试用谷歌搜索这个问题,但我不知道我应该向谷歌问什么问题。

最佳答案

这是 2.x java 驱动程序的包结构。 3.x 驱动程序的核心正在 org.mongodb 下移动,驱动程序兼容模块仍在 com.mongodb 命名空间下。

关于java - 为什么我将 ORG.mongodb.smth 添加到依赖项中,然后导入 COM.mongodb.smth?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20005322/

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