0
votes

sbt compile gives Success sbt run gives the error mentioned above.

My Directory Structure is a little bit different from the regular SBT structure:

Directory structure that I need... Build.sbt inside main project

Build.sbt inside SubProject

MainClass.scala

object MainClass extends App {
   println("Hello world!")
}

Note: Things I have already tried in Build.sbt of main project:

 1. scalaSource in (Compile, run) := baseDirectory.value / "App" / "js"  
 2. mainClass in (Compile, run) := Some("MainClass")
 3. mainClass in (Compile, run) := Some("App/js/src/main/scala/MainClass")

I am not able to figure out the mistake?

1

1 Answers

0
votes

It is not possible to declare additional projects in .sbt files that are in subdirectories. All projects have to be declared in .sbt files at the root of build.

This means that your AppJs and AppJvm never get to have any effect, and those projects do not actually exist in your build.

You'll have to declare AppJs, AppJvm, and any other project you need in the top-level build.sbt file.