Ошибки LinkingErg при обновлении с Scala.rx 0.3.2 до 0.4.0

В своем проекте я использую Scala.rx 0.3.2. Когда я обновился до версии 0.4.0 - без изменения какого-либо кода - я неожиданно получил много LinkingErrors для даже такого простого кода, как:

private val pageVisibility: Var[String] = Var(document.visibilityState.toString)
private def onPageVisibilityChanged(e: Event): Unit = {
   pageVisibility() = document.visibilityState.toString
}

val visible = Rx {
  pageVisibility().toString match {
    case "visible" => true
    case _         => false
  }
}

Вот LinkingErrors:

[info] Compiling 1 Scala source to C:\Users\...\target\scala-2.12\classes ...
[info] Done compiling.
[info] Fast optimizing C:\Users\...-fastopt.js
[error] Referring to non-existent class rx.package$GenericOps$
[error]   called from scalatags.rx.RxNodeInstances$rxStringFrag.render()org.scalajs.dom.raw.Text
[error]   called from scalatags.rx.RxNodeInstances$rxStringFrag.applyTo(org.scalajs.dom.raw.Element)scala.Unit
[error]   called from scalatags.rx.RxNodeInstances$rxStringFrag.applyTo(java.lang.Object)scala.Unit
[error]   called from scalatags.generic.TypedTag.build(java.lang.Object)scala.Unit
[error]   called from scalatags.JsDom$TypedTag.build(java.lang.Object)scala.Unit
[error]   called from scalatags.JsDom$TypedTag.render()org.scalajs.dom.raw.Element
[error]   called from scalatags.JsDom$TypedTag.toString()java.lang.String
[error]   called from com.xxxx.cc.b.core.base.xxxBase$.<init>()
[error]   called from com.xxxx.cc.b.xxxxx.xxxxxViewPage$.<init>()
[error]   called from com.xxxx.cc.b.navbar.xxxxxOptionsDropDown.<init>()
[error]   called from com.xxxx.cc.b.navbar.NavBar$.<init>()
[error]   called from com.xxxx.cc.b.base.xxx$.<init>()
[error]   exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error]   scalatags.rx.RxNodeInstances$rxStringFrag
[error]   scalatags.JsDom$TypedTag
[error] Referring to non-existent method rx.package$.GenericOps(rx.Rx)rx.Rx
[error]   called from scalatags.rx.RxNodeInstances$rxStringFrag.render()org.scalajs.dom.raw.Text
[error]   called from scalatags.rx.RxNodeInstances$rxStringFrag.applyTo(org.scalajs.dom.raw.Element)scala.Unit
[error]   called from scalatags.rx.RxNodeInstances$rxStringFrag.applyTo(java.lang.Object)scala.Unit
[error]   called from scalatags.generic.TypedTag.build(java.lang.Object)scala.Unit
[error]   called from scalatags.JsDom$TypedTag.build(java.lang.Object)scala.Unit
[error]   called from scalatags.JsDom$TypedTag.render()org.scalajs.dom.raw.Element
[error]   called from scalatags.JsDom$TypedTag.toString()java.lang.String
[error]   called from com.xxxx.cc.b.core.base.xxxBase$.<init>()
[error]   called from com.xxxx.cc.b.xxxxx.xxxxxViewPage$.<init>()
[error]   called from com.xxxx.cc.b.navbar.xxxxxOptionsDropDown.<init>()
[error]   called from com.xxxx.cc.b.navbar.NavBar$.<init>()
[error]   called from com.xxxx.cc.b.base.xxx$.<init>()
[error]   exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error]   scalatags.rx.RxNodeInstances$rxStringFrag
[error]   scalatags.JsDom$TypedTag
[error] Referring to non-existent method rx.package$GenericOps$.foreach$extension(rx.Rx,scala.Function1,rx.Ctx$Owner)rx.Obs
[error]   called from scalatags.rx.RxNodeInstances$rxStringFrag.render()org.scalajs.dom.raw.Text
[error]   called from scalatags.rx.RxNodeInstances$rxStringFrag.applyTo(org.scalajs.dom.raw.Element)scala.Unit
[error]   called from scalatags.rx.RxNodeInstances$rxStringFrag.applyTo(java.lang.Object)scala.Unit
[error]   called from scalatags.generic.TypedTag.build(java.lang.Object)scala.Unit
[error]   called from scalatags.JsDom$TypedTag.build(java.lang.Object)scala.Unit
[error]   called from scalatags.JsDom$TypedTag.render()org.scalajs.dom.raw.Element
[error]   called from scalatags.JsDom$TypedTag.toString()java.lang.String
[error]   called from com.xxxx.cc.b.core.base.xxxBase$.<init>()
[error]   called from com.xxxx.cc.b.xxxxx.xxxxxViewPage$.<init>()
[error]   called from com.xxxx.cc.b.navbar.xxxxxOptionsDropDown.<init>()
[error]   called from com.xxxx.cc.b.navbar.NavBar$.<init>()
[error]   called from com.xxxx.cc.b.base.xxx$.<init>()
[error]   exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error]   scalatags.rx.RxNodeInstances$rxStringFrag
[error]   scalatags.JsDom$TypedTag
[error] Referring to non-existent method rx.package$GenericOps$.foreach$extension(rx.Rx,scala.Function1,rx.Ctx$Owner)rx.Obs
[error]   called from scalatags.rx.RxStyleInstances$RxStyleValue.apply(org.scalajs.dom.raw.Element,scalatags.generic.Style,rx.Rx)scala.Unit
[error]   called from scalatags.rx.RxStyleInstances$RxStyleValue.apply(java.lang.Object,scalatags.generic.Style,java.lang.Object)scala.Unit
[error]   called from scalatags.generic.StylePair.applyTo(java.lang.Object)scala.Unit
[error]   called from scalatags.generic.TypedTag.build(java.lang.Object)scala.Unit
[error]   called from scalatags.JsDom$TypedTag.build(java.lang.Object)scala.Unit
[error]   called from scalatags.JsDom$TypedTag.render()org.scalajs.dom.raw.Element
[error]   called from scalatags.JsDom$TypedTag.toString()java.lang.String
[error]   called from com.xxxx.cc.b.core.base.xxxBase$.<init>()
[error]   called from com.xxxx.cc.b.xxxxx.xxxxxViewPage$.<init>()
[error]   called from com.xxxx.cc.b.navbar.xxxxxOptionsDropDown.<init>()
[error]   called from com.xxxx.cc.b.navbar.NavBar$.<init>()
[error]   called from com.xxxx.cc.b.base.xxx$.<init>()
[error]   exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error]   scalatags.rx.RxStyleInstances$RxStyleValue
[error]   scalatags.generic.StylePair
[error]   scalatags.JsDom$TypedTag
[error] Referring to non-existent method rx.package$.GenericOps(rx.Rx)rx.Rx
[error]   called from scalatags.rx.RxStyleInstances$RxStyleValue.apply(org.scalajs.dom.raw.Element,scalatags.generic.Style,rx.Rx)scala.Unit
[error]   called from scalatags.rx.RxStyleInstances$RxStyleValue.apply(java.lang.Object,scalatags.generic.Style,java.lang.Object)scala.Unit
[error]   called from scalatags.generic.StylePair.applyTo(java.lang.Object)scala.Unit
[error]   called from scalatags.generic.TypedTag.build(java.lang.Object)scala.Unit
[error]   called from scalatags.JsDom$TypedTag.build(java.lang.Object)scala.Unit
[error]   called from scalatags.JsDom$TypedTag.render()org.scalajs.dom.raw.Element
[error]   called from scalatags.JsDom$TypedTag.toString()java.lang.String
[error]   called from com.xxxx.cc.b.core.base.xxxBase$.<init>()
[error]   called from com.xxxx.cc.b.xxxxx.xxxxxViewPage$.<init>()
[error]   called from com.xxxx.cc.b.navbar.xxxxxOptionsDropDown.<init>()
[error]   called from com.xxxx.cc.b.navbar.NavBar$.<init>()
[error]   called from com.xxxx.cc.b.base.xxx$.<init>()
[error]   exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error]   scalatags.rx.RxStyleInstances$RxStyleValue
[error]   scalatags.generic.StylePair
[error]   scalatags.JsDom$TypedTag
[error] Referring to non-existent method rx.package$GenericOps$.foreach$extension(rx.Rx,scala.Function1,rx.Ctx$Owner)rx.Obs
[error]   called from scalatags.rx.RxAttrInstances$RxAttrValue.apply(org.scalajs.dom.raw.Element,scalatags.generic.Attr,rx.Rx)scala.Unit
[error]   called from scalatags.rx.RxAttrInstances$RxAttrValue.apply(java.lang.Object,scalatags.generic.Attr,java.lang.Object)scala.Unit
[error]   called from scalatags.generic.AttrPair.applyTo(java.lang.Object)scala.Unit
[error]   called from scalatags.generic.TypedTag.build(java.lang.Object)scala.Unit
[error]   called from scalatags.JsDom$TypedTag.build(java.lang.Object)scala.Unit
[error]   called from scalatags.JsDom$TypedTag.render()org.scalajs.dom.raw.Element
[error]   called from scalatags.JsDom$TypedTag.toString()java.lang.String
[error]   called from com.xxxx.cc.b.core.base.xxxBase$.<init>()
[error]   called from com.xxxx.cc.b.xxxxx.xxxxxViewPage$.<init>()
[error]   called from com.xxxx.cc.b.navbar.xxxxxOptionsDropDown.<init>()
[error]   called from com.xxxx.cc.b.navbar.NavBar$.<init>()
[error]   called from com.xxxx.cc.b.base.xxx$.<init>()
[error]   exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error]   scalatags.rx.RxAttrInstances$RxAttrValue
[error]   scalatags.generic.AttrPair
[error]   scalatags.JsDom$TypedTag
[error] Referring to non-existent method rx.package$.GenericOps(rx.Rx)rx.Rx
[error]   called from scalatags.rx.RxAttrInstances$RxAttrValue.apply(org.scalajs.dom.raw.Element,scalatags.generic.Attr,rx.Rx)scala.Unit
[error]   called from scalatags.rx.RxAttrInstances$RxAttrValue.apply(java.lang.Object,scalatags.generic.Attr,java.lang.Object)scala.Unit
[error]   called from scalatags.generic.AttrPair.applyTo(java.lang.Object)scala.Unit
[error]   called from scalatags.generic.TypedTag.build(java.lang.Object)scala.Unit
[error]   called from scalatags.JsDom$TypedTag.build(java.lang.Object)scala.Unit
[error]   called from scalatags.JsDom$TypedTag.render()org.scalajs.dom.raw.Element
[error]   called from scalatags.JsDom$TypedTag.toString()java.lang.String
[error]   called from com.xxxx.cc.b.core.base.xxxBase$.<init>()
[error]   called from com.xxxx.cc.b.xxxxx.xxxxxViewPage$.<init>()
[error]   called from com.xxxx.cc.b.navbar.xxxxxOptionsDropDown.<init>()
[error]   called from com.xxxx.cc.b.navbar.NavBar$.<init>()
[error]   called from com.xxxx.cc.b.base.xxx$.<init>()
[error]   exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error]   scalatags.rx.RxAttrInstances$RxAttrValue
[error]   scalatags.generic.AttrPair
[error]   scalatags.JsDom$TypedTag
[error] org.scalajs.core.tools.linker.LinkingException: There were linking errors
[error]         at org.scalajs.core.tools.linker.frontend.BaseLinker.linkInternal(BaseLinker.scala:160)
[error]         at org.scalajs.core.tools.linker.frontend.BaseLinker.linkInternal(BaseLinker.scala:108)
[error]         at org.scalajs.core.tools.linker.frontend.LinkerFrontend.$anonfun$link$3(LinkerFrontend.scala:63)
[error]         at org.scalajs.core.tools.logging.Logger.time(Logger.scala:28)
[error]         at org.scalajs.core.tools.logging.Logger.time$(Logger.scala:26)
[error]         at org.scalajs.sbtplugin.Loggers$SbtLoggerWrapper.time(Loggers.scala:7)
[error]         at org.scalajs.core.tools.linker.frontend.LinkerFrontend.link(LinkerFrontend.scala:62)
[error]         at org.scalajs.core.tools.linker.Linker.$anonfun$link$1(Linker.scala:52)
[error]         at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error]         at org.scalajs.core.tools.linker.Linker.guard(Linker.scala:69)
[error]         at org.scalajs.core.tools.linker.Linker.link(Linker.scala:50)
[error]         at org.scalajs.core.tools.linker.ClearableLinker.$anonfun$link$1(ClearableLinker.scala:52)
[error]         at org.scalajs.core.tools.linker.ClearableLinker.$anonfun$link$1$adapted(ClearableLinker.scala:52)
[error]         at org.scalajs.core.tools.linker.ClearableLinker.linkerOp(ClearableLinker.scala:63)
[error]         at org.scalajs.core.tools.linker.ClearableLinker.link(ClearableLinker.scala:52)
[error]         at org.scalajs.sbtplugin.ScalaJSPluginInternal$.$anonfun$scalaJSStageSettings$11(ScalaJSPluginInternal.scala:310)
[error]         at sbt.util.FileFunction$.$anonfun$cached$1(FileFunction.scala:73)
[error]         at sbt.util.FileFunction$.$anonfun$cached$4(FileFunction.scala:147)
[error]         at sbt.util.Difference.apply(Tracked.scala:313)
[error]         at sbt.util.Difference.apply(Tracked.scala:293)
[error]         at sbt.util.FileFunction$.$anonfun$cached$3(FileFunction.scala:143)
[error]         at sbt.util.Difference.apply(Tracked.scala:313)
[error]         at sbt.util.Difference.apply(Tracked.scala:288)
[error]         at sbt.util.FileFunction$.$anonfun$cached$2(FileFunction.scala:142)
[error]         at org.scalajs.sbtplugin.ScalaJSPluginInternal$.$anonfun$scalaJSStageSettings$10(ScalaJSPluginInternal.scala:315)
[error]         at sbt.std.Transform$$anon$3.$anonfun$apply$2(System.scala:46)
[error]         at sbt.std.Transform$$anon$4.work(System.scala:66)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:262)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error]         at sbt.Execute.work(Execute.scala:271)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:262)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error]         at java.lang.Thread.run(Thread.java:748)
[error] (Compile / fastOptJS) org.scalajs.core.tools.linker.LinkingException: There were linking errors
[error] Total time: 7 s, completed 19.12.2018 17:11:27

Я знаю, что это довольно специфическая проблема, но я был бы признателен за любые подсказки относительно того, где искать решение.

РЕДАКТИРОВАТЬ: после запуска whatDependsOn Я получаю следующий результат:

[IJ]sbt:yyy-yyyyy> whatDependsOn com.lihaoyi scalarx_sjs0.6_2.12
[info] com.lihaoyi:scalarx_sjs0.6_2.12:0.4.0 [S]
[info]   +-com-xxxx-xx-x-core:com-xxxx-xx-x-core_sjs0.6_2.12:0.1.0-SNAPSHOT [S]
[info]   | +-yyy-yyyyy:yyy-yyyyy_sjs0.6_2.12:0.1.0-SNAPSHOT [S]
[info]   |
[info]   +-com.timushev:scalatags-rx_sjs0.6_2.12:0.3.0 [S]
[info]   | +-com-xxxx-xx-x-core:com-xxxx-xx-x-core_sjs0.6_2.12:0.1.0-SNAPSHOT [S]
[info]   | | +-yyy-yyyyy:yyy-yyyyy_sjs0.6_2.12:0.1.0-SNAPSHOT [S]
[info]   | |
[info]   | +-yyy-yyyyy:yyy-yyyyy_sjs0.6_2.12:0.1.0-SNAPSHOT [S]
[info]   |
[info]   +-yyy-yyyyy:yyy-yyyyy_sjs0.6_2.12:0.1.0-SNAPSHOT [S]
[info]
[info] com.lihaoyi:scalarx_sjs0.6_2.12:0.3.2 (evicted by: 0.4.0)
[info]   +-com-xxxx-xx-x-core:com-xxxx-xx-x-core_sjs0.6_2.12:0.1.0-SNAPSHOT [S]
[info]   | +-yyy-yyyyy:yyy-yyyyy_sjs0.6_2.12:0.1.0-SNAPSHOT [S]
[info]   |
[info]   +-com.timushev:scalatags-rx_sjs0.6_2.12:0.3.0 [S]
[info]   | +-com-xxxx-xx-x-core:com-xxxx-xx-x-core_sjs0.6_2.12:0.1.0-SNAPSHOT [S]
[info]   | | +-yyy-yyyyy:yyy-yyyyy_sjs0.6_2.12:0.1.0-SNAPSHOT [S]
[info]   | |
[info]   | +-yyy-yyyyy:yyy-yyyyy_sjs0.6_2.12:0.1.0-SNAPSHOT [S]
[info]   |
[info]   +-yyy-yyyyy:yyy-yyyyy_sjs0.6_2.12:0.1.0-SNAPSHOT [S]

Этот результат показывает мне две проблемы:

  • В моем коде у меня нет ни одного libraryDependencies += "com.lihaoyi" %%% "scalarx" % "0.3.2" слева, так почему на него все еще ссылаются?
  • com.timushev scalatags-rx 0.3.0 также зависит от Scala.rx 0.3.2, поэтому я не могу обновить мой?

1 ответ

Решение

Я бы предположил (хотя бы предположение), что в вашей сборке есть конфликтующие версии Scala.Rx - что в более ранней версии, такой как 0.3.2, есть транзитивные зависимости. Поэтому они используют класс из 0.3.2, который больше не существует в 0.4.0.

Такого рода конфликт версий происходит время от времени; обычно это означает, что вам нужно обновить библиотеку, которая получает транзитивную зависимость. Плагин sbt-dependency-graph часто полезен для проверки всех библиотек и версий, которые вы фактически используете.

Другие вопросы по тегам