我有以下项目结构:
lazy val root = project.aggregate(rest,backend)
lazy val rest = project
lazy val backend = project
当我从父级执行“运行”任务时,我希望“后端”项目中的特定类执行其main
方法。我该如何做到这一点?
答案 0 :(得分:6)
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)