Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why SBT gives me "not found: object akka" with "import akka._"?

Tags:

scala

sbt

I've the following build.sbt file:

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"
)

When I import akka._ in a .scala file I'm getting the error:

[error] /home.......stocks/src/main/scala/main.scala:3: not found: object akka
[error] import akka._

Why?

like image 423
ROAR Avatar asked Mar 21 '23 17:03

ROAR


1 Answers

The directory structure needs to look like this:

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

And you have to launch sbt from the project's root directory (where the build.sbt file is).


Side note: If were to use a Scala build configuration instead of build.sbt, that would go in the project directory instead.

.
├── project
│   └── Build.scala
└── src
    └── main
        └── scala
            └── main.scala
like image 114
Chris Martin Avatar answered Apr 02 '23 18:04

Chris Martin