I have a multi-project definition something like the following:
lazy val commonSettings = settings(
libraryDependencies ++= Seq(
"ch.qos.logback" % "logback-classic" % "1.1.2",
...
)
lazy val core = (project in file(".")).
settings(commonSettings: _*).
settings(...
)
lazy val web = (project in file("web")).
settings(commonSettings: _*).
settings(...
).dependsOn(core)
The problem is that I want to set up the web project to use the Scala JS client/server model. So I need to expand the web project to use crossProject to split into the js/jvm/shared parts. But I am not sure of the best way to achieve this. If I try to do something like:
lazy val web = crossProject.
settings(commonSettings: _*).
settings(...
).jsSettings(...
).jvmSettings(...
).dependsOn(core)
I get a compilation error for my build.scala:
... type mismatch; [error] found : sbt.Project [error] required: org.scalajs.sbtplugin.cross.CrossClasspathDependency [error] lazy val web = crossProject.settings().jsSettings().jvmSettings().dependsOn(core) [error]
^
Leave out the dependsOn for the web project.
lazy val webJS = web.js.dependsOn(...)
It made the trick for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With