Why can't SBT recognize the `idePackagePrefix` in build.sbt and find the tests written with scalatest ?
已回答
It's a small project of Scala with SBT 1.8.0 as the builder. It builds and tests well on my PC, but not work on my laptop after it pulls the same project from my git repositoy.
- The repository only has
.gitignore
,build.sbt
and foldersrc
, nothing else. - The
build.sbt
is like this below, and the tests are written with ScalaTest.
ThisBuild / scalaVersion := "2.13.10"
lazy val root = (project in file("."))
.settings(
name := "project",
idePackagePrefix := Some("org.meeeee")
)
val AkkaVersion = "2.7.0"
libraryDependencies ++= Seq(
// ... the others ...
"org.scalatest" %% "scalatest" % "3.2.14" % "test",
"org.scalatest" %% "scalatest-featurespec" % "3.2.14" % "test"
)
Problem I: "error: not found: value idePackagePrefix".
When compiling the project, it shows "error: not found: value idePackagePrefix".
If I comment the line ideaPackagePrefix := Some("org.meeeee")
, then the project compiles well.
Problem II: "Did not find suite classes in package xxx"
When I right-click the test package domain in folder test
and run all scalatest, the IDEA shows "Error running "domain" ScalaTest: Did not find suite classes in package domain.".
But I tried sbt test
, it runs all tests in the domain in sbt console.
Even I tried run test in the package independently, the IDEA works well.
How to fix it? Thanks.
请先登录再写评论。
Hi Korby,
I submitted a bug report for these problems to our tracking system so that the Dev team can look into it:
Please add a comment there with information about your Scala plugin version and the entire idea.log file collected after reproducing the issue (will be attached privately): Help | Show Log in...
OK,I've uploaded log file to the YouTrack.
Thank you.
Hello!
Regarding the first problem please make sure you have ide plugin enabled in your /project/plugins.sbt