Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sbt: run task on subproject

Tags:

sbt

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?

like image 270
ThaDon Avatar asked Nov 21 '13 21:11

ThaDon


1 Answers

lazy val root = project.aggregate(rest,backend).dependsOn(rest,backend) //<- don't forget dependsOn
lazy val rest = project
lazy val backend = project.settings(mainClass in (Compile, run) := Some("fully.qualified.path.to.MainClass"))

run in Compile <<= (run in Compile in backend)
like image 155
Schleichardt Avatar answered Oct 16 '22 20:10

Schleichardt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!