The Artima Developer Community
Sponsored Link

Akka Concurrency Forum
object scalatest is not a member of package org

4 replies on 1 page. Most recent reply: Mar 21, 2013 10:17 AM by Derek Wyatt

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 4 replies on 1 page
Eric Loots

Posts: 5
Nickname: 84502
Registered: Nov, 2012

object scalatest is not a member of package org Posted: Mar 21, 2013 7:06 AM
Reply to this message Reply
Advertisement
Just started reading Chapter 6 (Akka Testing) of the book.

Made the modification to the sbt dependencies, so my sbt configuration file looks this:


$ more project/Chapter6Build.scala
import sbt._
import sbt.Keys._

object AkkaProjectInScalaBuild extends Build {

lazy val akkaProjectInScala = Project(
id = "akka-project-in-scala",
base = file("."),
settings = Project.defaultSettings ++ Seq(
name := "Akka Project In Scala",
organization := "org.example",
version := "0.1-SNAPSHOT",
scalaVersion := "2.10.0",
scalacOptions ++= Seq("-feature", "-deprecation"),
resolvers += "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases",
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "2.0.M5b" % "test",
"com.typesafe.akka" %% "akka-testkit" % "2.1.0",
"com.typesafe.akka" %% "akka-actor" % "2.1.2"
)
)
)
}


Running 'sbt update' and 'sbt compile' give the following:


$ sbt update
[info] Loading project definition from /Users/ericloots/Desktop/Scala course WCopy/Scala/Scala course/Akka/chapter-6/project
[info] Updating {file:/Users/ericloots/Desktop/Scala%20course%20WCopy/Scala/Scala%20course/Akka /chapter-6/project/}default-057ea0...
[info] Resolving org.scala-sbt#precompiled-2_10_0;0.12.2 ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/ericloots/Desktop/Scala course WCopy/Scala/Scala course/Akka/chapter-6/project/target/scala-2.9.2/sbt-0.12/classes...
[info] Set current project to Akka Project In Scala (in build file:/Users/ericloots/Desktop/Scala%20course%20WCopy/Scala/Scala%20course/Akka/ chapter-6/)
[info] Updating {file:/Users/ericloots/Desktop/Scala%20course%20WCopy/Scala/Scala%20course/Akka /chapter-6/}akka-project-in-scala...
[info] Resolving org.scalatest#scalatest_2.10;2.0.M5b ...
[info] Done updating.
[success] Total time: 0 s, completed Mar 21, 2013 11:51:35 AM

$ sbt compile
[info] Loading project definition from /Users/ericloots/Desktop/Scala course WCopy/Scala/Scala course/Akka/chapter-6/project
[info] Set current project to Akka Project In Scala (in build file:/Users/ericloots/Desktop/Scala%20course%20WCopy/Scala/Scala%20course/Akka/ chapter-6/)
[info] Compiling 6 Scala sources to /Users/ericloots/Desktop/Scala course WCopy/Scala/Scala course/Akka/chapter-6/target/scala-2.10/classes...
[error] /Users/ericloots/Desktop/Scala course WCopy/Scala/Scala course/Akka/chapter-6/src/main/scala/zzz/akka/TestEventSource.scala:5: object scalatest is not a member of package org
[error] import org.scalatest.WordSpec
[error] ^
[error] one error found
[error] (compile:compile) Compilation failed
[error] Total time: 3 s, completed Mar 21, 2013 11:52:14 AM


Any idea what may be wrong?


Derek Wyatt

Posts: 64
Nickname: dwyatt
Registered: Oct, 2012

Re: object scalatest is not a member of package org Posted: Mar 21, 2013 7:21 AM
Reply to this message Reply
Yup.

The build configuration states that the scalatest library is provided in the "test" configuration. You've put your "test" code in the "main" source area.

Move the test file into src/test/scala/ instead of src/main/scala.

And, technically, 'sbt compile' won't do anything with the test class now that you've moved it. To compile it, you want 'sbt test:compile' and to test it (as well as compile it) you want 'sbt test'.

Cheers,
D

Eric Loots

Posts: 5
Nickname: 84502
Registered: Nov, 2012

Re: object scalatest is not a member of package org Posted: Mar 21, 2013 7:32 AM
Reply to this message Reply
Thanks Derek - code does compile now.

Any suggestion about a way to get up-to-speed on sbt as to be able to 'debug' this kind of errors?

Cheers -- Eric

Eric Loots

Posts: 5
Nickname: 84502
Registered: Nov, 2012

Re: object scalatest is not a member of package org Posted: Mar 21, 2013 7:35 AM
Reply to this message Reply
Just started looking at http://www.scala-sbt.org/release/docs/Getting-Started/Welcome.html

...

Cheers

Derek Wyatt

Posts: 64
Nickname: dwyatt
Registered: Oct, 2012

Re: object scalatest is not a member of package org Posted: Mar 21, 2013 10:17 AM
Reply to this message Reply
That would be my recommendation :)

Flat View: This topic has 4 replies on 1 page
Topic: ByteString I/O Previous Topic   Next Topic Topic: Time out exception for ask should be AskTimeoutException


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us