6

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]
^

user79074
  • 4,937
  • 5
  • 29
  • 57
  • Can you share the complete error message? Why do you want to extends an existing project? Have you looked at the example [here](http://www.scala-js.org/api/sbt-scalajs/0.6.1/index.html#org.scalajs.sbtplugin.cross.CrossProject)? – marios Jun 10 '15 at 18:08
  • On the contrary, you probably want to make your `core` a cross-project, and leave `web` a normal project with `.enablePlugins(ScalaJSPlugin)`. – sjrd Jun 11 '15 at 18:40

1 Answers1

3

Leave out the dependsOn for the web project.

lazy val webJS = web.js.dependsOn(...)

It made the trick for me.

Mikaël Mayer
  • 10,425
  • 6
  • 64
  • 101