我有以下build.sbt
文件:
name := "Stocks"
version := "1.0"
scalaVersion := "2.10.2"
resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/"
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.5.2")
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.2.3",
"com.typesafe.akka" %% "akka-slf4j" % "2.2.3",
"com.typesafe.akka" %% "akka-remote" % "2.2.3",
"com.typesafe.akka" %% "akka-agent" % "2.2.3",
"com.typesafe.akka" %% "akka-testkit" % "2.2.3" % "test"
)
当我在import akka._
文件中.scala
时,我收到错误:
[error] /home.......stocks/src/main/scala/main.scala:3: not found: object akka
[error] import akka._
为什么?
答案 0 :(得分:6)
目录结构需要如下所示:
.
├── build.sbt
└── src
└── main
└── scala
└── main.scala
您必须从项目的根目录(sbt
文件所在的位置)启动build.sbt
。
附注:如果要使用Scala构建配置而不是build.sbt
,则会改为project
目录。
.
├── project
│ └── Build.scala
└── src
└── main
└── scala
└── main.scala