Dmitry  Meshkov
Dmitry Meshkov

Reputation: 931

Scala - Running main class from library

I have 2 sbt projects A is depends on B. Is there a way to run project A with main class, defined in project B? Command "sbt run" give me the error, that no main class found in project

Upvotes: 1

Views: 156

Answers (2)

Moritz
Moritz

Reputation: 925

You missed to specify your main class (in this case a class of project B) in your build.sbt of project A:

mainClass := Some("full.path.in.projectb.Main")

Upvotes: 1

yǝsʞǝla
yǝsʞǝla

Reputation: 16412

You can change your current project to B and run the main class from there.

In SBT shell:

project B
run

If you are running SBT from command line noninteractively, then:

sbt ';project B; run'

or:

sbt 'project B' run

Upvotes: 1

Related Questions