0

I have a strange problem in IntelliJ IDEA: I have an SBT project which has ScalaTests. I organized my settings in blocks like this:

lazy val common = Seq(
  organization := "com.example.foo",
  version := "0.0.1-SNAPSHOT",
  scalaVersion := "2.10.5",
  fork in Test := true,
  testListeners += new JUnitXmlTestsListener(
    new File(target.value, "test-reports").getAbsolutePath
  )
)

lazy val testWithScalatest = Seq(
  libraryDependencies += "org.scalatest" %% "scalatest" % "2.2.4" % "test"
)

lazy val bar = project.in(file("some/where/foo/bar")).settings(common).settings(testWithScalatest).settings(name:="bar")

When I run sbt test, the tests run fine without any errors. However, when I right-click the test class in the project explorer of IDEA, the "Run tests" option is not there. I can right-click the package the test class is in and select "Run ScalaTests in...", but then I get something like this:

Error running ScalaTests in 'bar': Cannot start process, the working directory C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 14.1.4\jre\jre\bin does not exist

When I try to edit the run configuration, the settings panel in the "Run/Debug Configurations" window is empty.

I cannot add a new configuration either.

What is the problem here?

EDIT: I have the same problem when using Specs2.

rabejens
  • 7,594
  • 11
  • 56
  • 104

2 Answers2

0

I kind of solved it. I re-installed IntelliJ IDEA and removed my .ideaIC14 folder. Then I re-ran git clean -fdx and sbt clean. Seems that some internal cache got wonky...

Next time, I try if Invalidate Caches / Restart is enough before reinstalling everything

rabejens
  • 7,594
  • 11
  • 56
  • 104
0

I think, you've not specified the working directory in the configuration window while building your project.

Specify it to your project root directory and it may solve the problem :)enter image description here

Ankit
  • 67
  • 4
  • I really did not check this back then, but this problem also happened to me for ScalaTests which ran before. They worked, and somehow suddenly stopped. But I also flicked around Git branches and did some related work on the command line, so I think this messed up the indexes. – rabejens Nov 01 '15 at 09:53