sbt: run task on subproject
sbt
Solution
lazy val root = project
.aggregate(rest, backend)
.dependsOn(rest, backend) //<- don't forget dependsOn
lazy val rest =
project
lazy val backend =
project.settings(
Compile / run / mainClass := Some("fully.qualified.path.to.MainClass")
)
Compile / run := (backend / Compile / run).evaluated
Problem
I have the following project structure: ``` lazy val root = project.aggregate(rest,backend) lazy val rest = project lazy val backend = project ``` When I execute the "run" task from the parent, I want a specific class from the "backend" project to have its `main` method executed. How would I accomplish this?