在我的项目中,我使用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,因此显然我不能升级我的吗? 答案 0 :(得分:1)
我会猜测(请记住,只是一个猜测),您的版本中有Scala.Rx版本有冲突-在早期版本(如0.3.2。)中存在传递依赖。因此,他们使用的是0.3.2中的类,而该类不再存在于0.4.0中。
这种版本冲突不时发生;通常,这意味着您需要更新引入传递依赖关系的库。 sbt-dependency-graph插件通常有助于检查您实际使用的所有库和版本。