【问题标题】:Can't resolve casbah as a sbt dependency无法将 casbah 解析为 sbt 依赖项
【发布时间】:2014-07-22 20:28:50
【问题描述】:

编译时出现以下错误:

[error] (*:update) sbt.ResolveException: unresolved dependency: org.mongodb#casbah_2.11;2.7.4-SNAPSHOT: not found

有了这个 build.sbt 文件:

name := """play-scala"""

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
  jdbc,
  anorm,
  cache,
  ws
)

libraryDependencies += "org.mongodb" %% "casbah" % "2.7.4-SNAPSHOT"

// For stable releases
resolvers += "Sonatype releases" at "https://oss.sonatype.org/content/repositories/releases"

// For SNAPSHOT releases
resolvers += "Sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

我正在使用 Typesafe Activator,并尝试了多种 Casbah 版本(包括发行版,而不是快照)和解析器的组合。 installation instructions from the "official" MongoDB Casbah tutorial 也不起作用。有什么想法吗?

【问题讨论】:

    标签: mongodb scala casbah


    【解决方案1】:

    如果您转到发布和快照 URL 并尝试手动定位 casbah,您会看到当前的 snapshot url doesn't have anything for casbah

    另一方面,发布 repo 有 Scala 2.11 的 2.7.3。 Check it out here.

    不妨试试

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

    【讨论】:

    • 我会修复文档 - 抱歉,我是在为将来的工作修改版本后构建的。正如一个 FYI 主要版本总是在邮件列表中公布:groups.google.com/group/mongodb-casbah-users 通常在 Casbah 中,快照仅在代码与之前的稳定版本不同时发布。
    • 我在 2.7.4 中遇到了类似的问题,并添加了 pomOnly()使其工作。 libraryDependencies += "org.mongodb" %% "casbah" % "2.7.4" pomOnly()
    【解决方案2】:

    在您的 build.sbt 文件中使用以下依赖项:

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

    【讨论】:

      【解决方案3】:

      使用这些库

        "org.mongodb" %% "casbah" % "3.1.1",
        "org.json4s" %% "json4s-jackson" % "3.5.2",
        "org.json4s" %% "json4s-mongo" % "3.5.2"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-07-22
        • 2017-05-06
        • 2019-07-03
        • 2016-06-17
        • 2021-11-07
        • 2020-05-27
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多