SBT: How to define dependencies of subprojects in subprojects' build.sbt files?

陌路散爱 提交于 2019-12-21 20:58:40

问题


The following build.sbt file works, but it defines the dependencies of all subprojects:

name := "myproject"

version := "1.0"

scalaVersion := "2.11.8"

libraryDependencies ++= Seq(
  "org.scalafx" %% "scalafx" % "8.0.60-R9"
)


lazy val aLib = (project in file("lib/a"))
lazy val bLib = (project in file("lib/b"))
  .dependsOn(aLib)
  .dependsOn(cLib)
lazy val cLib = (project in file("lib/c"))
  .dependsOn(aLib)
lazy val myApp = (project in file("myapp"))
  .dependsOn(aLib)
  .dependsOn(bLib)
  .dependsOn(cLib)
  .aggregate(aLib, bLib, cLib)

Since each subproject (directories lib/a, lib/b, lib/c, myapp) has its own build.sbt file, I would like to use those build files to define the individual dependencies of each project.

I tried to move the dependsOn/aggregate statements to the subprojects' build files, but I am not able to make it work that way. What is the recommended way?

来源:https://stackoverflow.com/questions/37257130/sbt-how-to-define-dependencies-of-subprojects-in-subprojects-build-sbt-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!