我正在尝试构建一个包含GitHub repo作为依赖项的scala-js项目。从阅读this page和this stackoverflow post看来,应该使用ProjectRef
完成此操作,然后使用jsConfigure
在交叉项目中加入。见下文:
name := "My Project root project"
lazy val root = project.in(file(".")).
aggregate(myProjectJS, myProjectJVM).
settings(
publish := {},
publishLocal := {}
)
lazy val myProject = crossProject.in(file(".")).
settings(
name := "myProject",
version := "0.1-SNAPSHOT",
scalaVersion := "2.12.4",
testFrameworks += new TestFramework("utest.runner.Framework"),
resolvers ++= Seq(
"Sonatype Releases" at "https://oss.sonatype.org/content/repositories/releases/"
),
libraryDependencies += "org.typelevel" %%% "spire" % "0.14.1",
libraryDependencies += "com.lihaoyi" %%% "utest" % "0.6.0" % Test,
libraryDependencies += "org.seleniumhq.selenium" % "selenium-java" % "3.7.1" % Test
).
jsConfigure(_.dependsOn(rxscalajs)).
jsSettings(
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "0.9.3",
jsDependencies += "org.webjars.npm" % "rxjs" % "5.3.0" / "bundles/Rx.min.js" commonJSName "Rx"
)
lazy val rxscalajs = ProjectRef(uri(s"https://github.com/LukaJCB/rxscala-js.git#master"), "root")
lazy val myProjectJVM = myProject.jvm
lazy val myProjectJS = myProject.js
但是这样做会导致链接错误与其他依赖项(在这种情况下为spire
)。
[error] Referring to non-existent method cats.kernel.Order.on$mIcI$sp(scala.Function1)cats.kernel.Order
[error] called from spire.std.LongAlgebra.on$mIcI$sp(scala.Function1)cats.kernel.Order
...
[error] (myProjectJS/compile:fullOptJS) org.scalajs.core.tools.linker.LinkingException: There were linking errors
有谁知道造成这种情况的原因以及如何解决?