Say I have two sub-projects, lib1
and lib2
with build.sbt
s that look like this:
lazy val libX = crossProject.in(file(".")).settings(
... // a bunch of settings
).jvmSettings(
... // a bunch of settings
).jsSettings(
... // a bunch of settings
)
lazy val libXJVM = apiClient.jvm
lazy val libXJS = apiClient.js
I need to use them in another large multi-module project so that lib2
depends on lib1
.
If I try this in the main build.sbt
:
lazy val lib1 = crossProject.in(file("lib1"))
lazy val lib2 = crossProject.in(file("lib2")).dependsOn(lib1)
lazy val lib1JVM = lib1.jvm
...
then the project dependency seems to work but the settings from the libraries internal build.sbt
files (e.g. libraryDependencies
) are completely ignored and the build fails.
If I try this instead:
lazy val lib1JS = project.in(file("lib1"))
lazy val lib2JS = project.in(file("lib2")).dependsOn(lib1JS)
dependsOn
is seemingly ignored and lib2 won't compile because it can't import types from lib1.
Is there any way to make this work without duplicating the crossProject settings in the main build file?