Java Scala+;日食+;Casbah=对象mongodb不是包com的成员

Java Scala+;日食+;Casbah=对象mongodb不是包com的成员,java,eclipse,mongodb,scala,casbah,Java,Eclipse,Mongodb,Scala,Casbah,我正在用喷雾剂喷casbah和salat。我在导入casbah导入时出现此错误 import com.mongodb.casbah.Imports._ object mongodb is not a member of package com 但是,sbt在没有任何警告的情况下成功编译。我的build.sbt看起来 scalaVersion := "2.10.3" scalacOptions := Seq("-unchecked", "-deprecation", "-encoding"

我正在用喷雾剂喷casbah和salat。我在导入casbah导入时出现此错误

import com.mongodb.casbah.Imports._

object mongodb is not a member of package com
但是,sbt在没有任何警告的情况下成功编译。我的build.sbt看起来

scalaVersion  := "2.10.3"

scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "utf8")

resolvers ++= Seq(
  "spray repo" at "http://repo.spray.io/",
   "Sonatype releases" at "https://oss.sonatype.org/content/repositories/releases"
)

libraryDependencies ++= {
  val akkaV = "2.2.3"
  val sprayV = "1.2.0"
  Seq(
    "io.spray"            %   "spray-can"     % sprayV,
    "io.spray"            %   "spray-routing" % sprayV,
    "io.spray"            %   "spray-testkit" % sprayV  % "test",
    "com.typesafe.akka"   %%  "akka-actor"    % akkaV,
    "com.typesafe.akka"   %%  "akka-testkit"  % akkaV   % "test",
    "org.specs2"          %%  "specs2-core"   % "2.3.7" % "test",
    "org.mongodb"         %%  "casbah"        % "2.7.0-RC0",
    "com.novus"           %%  "salat"         % "1.9.5"
  )
}

有没有关于如何说服Eclipse找到包的想法?

使用sbteclipse插件来配置Eclipse项目:
Salat使用Casbah 2.6.4,并将其列为依赖项[1],因此尝试使用两个不同的版本可能会出现问题。尝试将其更改为
2.6.4
,或者删除它并允许salat隐式声明它


[1]

我最终编辑了原始模板spray项目,将casbah和salat依赖项添加到build.sbt中,运行sbt eclipse,并手动将新的.classpath文件复制到导入的eclipse项目中。

我已经在spray模板项目中使用了它,它工作得很好,只有在casbahI删除了scalat依赖项,清理了项目并重新启动了eclipse之后,它才会失败。仍然没有好处,如果使用“导入现有项目”,则不需要手动复制它。这会将您的工作区项目链接到签出位置,并且每次使用sbteclipse重新生成项目时,都会在刷新后拾取更改(如果您将Eclipse配置为监视文件系统,则会自动拾取更改)。