sbt查找所请求依赖项的另一个版本

时间:2019-07-25 13:18:54

标签: scala sbt

project / plugins.sbt

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.28")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.15.0")

build.sbt(简体)

enablePlugins(ScalaJSBundlerPlugin)
scalaVersion := "2.12.8"
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "0.9.7"
libraryDependencies += "com.github.karasiq" %%% "scalajs-bootstrap-v4" % "2.3.5"

但是失败如下:

$ sbt fastOptJS::webpack
[error] sbt.librarymanagement.ResolveException: unresolved dependency: com.github.karasiq#scalajs-bootstrap-v4_sjs1.0.0-M7_2.12;2.3.5: not found

为什么要寻找scalajs-bootstrap-v4_sjs1.0.0-M7而不是scalajs-bootstrap-v4

最小项目在这里:https://github.com/dportabella/scalajs-bootstrap4-examples

1 个答案:

答案 0 :(得分:3)

project/plugins.sbt中尝试以下版本,它们模仿scalajs-bootstrap的plugins.sbt

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.20")
addSbtPlugin("com.github.karasiq" % "sbt-scalajs-bundler" % "1.2.1")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.13.0")

build.sbt

scalaVersion := "2.12.6"
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "0.9.7"
libraryDependencies += "com.github.karasiq" %%% "scalajs-bootstrap-v4" % "2.3.5"

请注意将Scala的版本从2.12.8降级到2.12.6。