I want to write some tests for my toy project in scalatest. As I use sbt
I installed scalatest via libraryDependencies += "org.scalatest" %% "scalatest" % "2.0.M5" % "test"
in my project root's build.sbt
. Then I created test class in src/test/scala
:
package parsers
import org.scalatest.FunSuite
class BaseParserSuite extends FunSuite {
test("test works") {
val result = 2
assert(result === 2)
}
}
I run it via sbt test
and it works. But the annoying thing is that on line 3 with import org.scalatest.FunSuite
eclipse says:
Multiple markers at this line
- object scalatest is not a member of package org
- object scalatest is not a member of package org
The import
part is taken from this example. So the general question is: why is it working via sbt and eclipse reports the error? And where is the imported code from org.scalatest.
? Or it is not physically downloaded to my computer? And as a guess -- should I add something to .classpah eclipse file?
You should use the sbt elcipse plugin. It generates eclipse project definitions from your sbt build definition so all the libraries needed will be on the class path. See https://github.com/typesafehub/sbteclipse#for-the-impatient
I encountered the same issue and resolved by deleting the project (do not click on the delete the actual files checkbox). And then I imported the "preexisting project in workspace".
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