SBT: Dependency On Other SBT Project Without Publishing

梦想的初衷 提交于 2019-12-03 23:43:54

With SBT you can use source dependencies.

lazy val root = Project("root", file("."), settings = ...) dependsOn(dispatchLiftJson)

lazy val dispatchLiftJson = uri("git://github.com/dispatch/dispatch-lift-json#0.1.0")

It will fetch from git in this example. You may be able to specify a file location on disk, although I can't find examples. Possibly

lazy val dep = file("/path/to") 

or

lazy val dep = uri("file:///path/to")

I'm struggling with this myself - at the moment im using the publish-local method which is working ok.

Given directories

  • /build/some_app/
  • /build/some_lib/

File /build/some_app/build.sbt:

lazy val someLib = ProjectRef(file("../some_lib"), "exportedSomeLib")
// = RootProject(file("../some_lib")) also works?

lazy val root = (project in file("."))
                .dependsOn(someLib)

In /build/some-lib/build.sbt:

lazy val exportedSomeLib = (project in file("."))

Caveat: note that items defined in both root scopes of these files will not always lead to errors, but silently change values in the global (?) scope if the keys (=the value names) clash across .sbt files. 😞

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