1

As I found out, defining a main in sbt 0.12 and 0.13 seems different. My sbt version is 0.12.2. I have a few projects in one project. show compile:discovered-main-classes returns the list of the main classes of the project those have it (some of them doesn't have it because they are libraries).

Even in sbt 0.13 there are 2 approaches as you can see here how to set main class in SBT 0.13 project (I don't need those ones, though because I use 0.12.2 version)

I didn't specify a main class, therefore whenever I run run I get an error:

java.lang.RuntimeException: No main class detected.
    at scala.sys.package$.error(package.scala:27)

How do I specify a main class in a appropriate file in project directory of the project?

Community
  • 1
  • 1
Incerteza
  • 32,326
  • 47
  • 154
  • 261
  • It is looks like you run `run` command in project without mail class. Two possible solutions: 1) create a main class; 2) choose a project with main class by command `project ` – Yuriy Nov 06 '13 at 12:21
  • @Yury, thanks, this is one of the options, but I want another one. As I said, almost each project has a main class unless that's a library. – Incerteza Nov 06 '13 at 12:28
  • Is this a multi-module build? Can you show us some of it? Are you settings in `build.sbt` or in `project/build.scala`? If they're in `build.sbt` are they scoped by the sub-project? (`mainClass in projectVal := ...`) – jsuereth Nov 06 '13 at 13:42

0 Answers0