scalatest : object scalatest is not a member of package org
<p><strong>EDIT</strong> : it works if the file is in src/test/scala/tests/ but not in src/main/scala/mypackage/  Why ?</p>

<p>I have try solutions from topics with people having nearly the same issue but none works.</p>

<p>In details, I have this in build.sbt : </p>

<pre><code>libraryDependencies ++= Seq(
   ...
  "org.scalatest" % "scalatest_2.10" % "2.2.1" % "test",
   ...
</code></pre>

<p>In intellij a class with: </p>

<pre><code>import org.scalatest.{BeforeAndAfterAll, Suite}
</code></pre>

<p>with {BeforeAndAfterAll, Suite} in red so i guess scalatest is found</p>

<p>sbt package does not work too : </p>

<blockquote>
  <p>object scalatest is not a member of package org [error] import
  org.scalatest. {BeforeAndAfterAll, Suite}</p>
</blockquote>

<p>I have already tries this : </p>

<ul>
<li>sbt clean update</li>
<li>restart + invalidate cache of intellij</li>
<li>remove .idea/ and reimport</li>
<li>libraryDependencies += "org.scalatest" % "scalatest_2.10" % "2.0" % "test" instead ogf the actual</li>
<li>magical ritual on my keyboard</li>
</ul>

<p>Nothing works</p>

<p>Any idea ?</p>