Search code examples
javascalajarsbtsbt-assembly

Cannot find main class to run .jar, from Sbt-Assembly


MyProject/build.sbt

    mainClass in assembly := Some("Boot")

MyProject/Boot.scala

    package src.main.myproject

    object Boot extends App { ... }

Other Project Files:

    MyProject/src/main/scala/myproject/someFile.scala

Running the jar returns the error:

    Error: Could not find or load main class Boot

Is there a problem with my project structure?


Solution

  • Your Boot is in src.main.myproject, so the mainClass should be src.main.myproject.Boot

    Off topic in terms of the question, but it doesn't seem conventional that src.main is part of your package structure though, normally scala src directory of sbt is set to src/main/scala