为什么SBT用“import akka._”给我“找不到:对象akka”?

时间:2014-02-01 21:20:07

标签: scala sbt

我有以下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._

为什么?

1 个答案:

答案 0 :(得分:6)

目录结构需要如下所示:

.
├── build.sbt
└── src
    └── main
        └── scala
            └── main.scala

您必须从项目的根目录(sbt文件所在的位置)启动build.sbt


附注:如果要使用Scala构建配置而不是build.sbt,则会改为project目录。

.
├── project
│   └── Build.scala
└── src
    └── main
        └── scala
            └── main.scala