I created a scala project using SBT and wrote some unit test cases using scalatest. But somehow sbt test
can't find the org.scalatest package.
Here my project definition files:
src/main/scala respective src/test/scala
build.sbt
:
name := "MyProject"
version := "0.1"
scalaVersion := "2.9.2"
project/plugins.sbt
:
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
project/build.sbt
:
libraryDependencies += "org.scalatest" %% "scalatest" % "1.8" % "test"
I'm using SBT 0.11.3.
Compiling the program using sbt compile
on the console works fine.
Furthermore I found the scalatest jar in ~/.ivy2
, so SBT must have downloaded it.
But when running sbt test
, it says
object scalatest is not a member of package org
[error] import org.scalatest.FlatSpec
...[many errors alike]
And running sbt eclipse
creates a .classpath that doesn't contain the scalatest jar.
Do I have to specify the test dependencies somewhere else? How should I add the scalatest library?
Place libraryDependencies += "org.scalatest" %% "scalatest" % "1.8" % "test"
into build.sbt, not project/build.sbt.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With