ScalaJs + ZIO:程序适用于 sbt 1.2.8,但不适用于 >= 1.3



我正在使用上的示例应用程序用zio试用scala.jshttps://github.com/wongelz/zio-scalajs-solarsystem

一旦我将sbt版本从1.2.8更新到1.3.13或1.4.4,我就会收到以下错误:

[error] Referring to non-existent method java.time.LocalTime$.NANOS_PER_SECOND()long
[error]   called from private java.time.LocalDateTime.plusWithOverflow(java.time.LocalDate,long,long,long,long,int)java.time.LocalDateTime
[error]   called from java.time.LocalDateTime.plusNanos(long)java.time.LocalDateTime
[error]   called from java.time.LocalDateTime.plus(long,java.time.temporal.TemporalUnit)java.time.LocalDateTime
[error]   called from java.time.LocalDateTime.plus(long,java.time.temporal.TemporalUnit)java.time.temporal.Temporal
[error]   called from java.time.temporal.ChronoUnit.addTo(java.time.temporal.Temporal,long)java.time.temporal.Temporal
[error]   called from java.time.OffsetDateTime.plus(long,java.time.temporal.TemporalUnit)java.time.OffsetDateTime
[error]   called from java.time.OffsetDateTime.plus(long,java.time.temporal.TemporalUnit)java.time.temporal.Temporal
[error]   called from java.time.Duration.addTo(java.time.temporal.Temporal)java.time.temporal.Temporal
[error]   called from java.time.OffsetDateTime.plus(java.time.temporal.TemporalAmount)java.time.OffsetDateTime
[error]   called from private zio.Schedule$.$anonfun$fixed$2(scala.Option,java.time.OffsetDateTime,long,java.time.Duration,long,scala.runtime.LazyRef)zio.Schedule$Decision
[error]   called from private zio.Schedule$.$anonfun$fixed$1(scala.Option,long,java.time.Duration,long,scala.runtime.LazyRef,java.time.OffsetDateTime,java.lang.Object)zio.ZIO
[error]   called from private zio.Schedule$.loop$23(scala.Option,long,long,java.time.Duration,scala.runtime.LazyRef)scala.Function2
[error]   called from zio.Schedule$.fixed(java.time.Duration)zio.Schedule
[error]   called from private SolarSystemExample$.$anonfun$run$1(SolarSystemExample$SolarSystem)zio.ZIO
[error]   called from SolarSystemExample$.run(scala.collection.immutable.List)zio.ZIO
[error]   called from private zio.App.$anonfun$main$1([java.lang.String)zio.ZIO
[error]   called from zio.App.main([java.lang.String)void
[error]   called from SolarSystemExample$.main([java.lang.String)void
[error]   called from static SolarSystemExample.main([java.lang.String)void
[error]   called from core module module initializers
[error] involving instantiated classes:
[error]   java.time.LocalDateTime
[error]   java.time.temporal.ChronoUnit
[error]   java.time.OffsetDateTime
[error]   java.time.Duration
[error]   zio.Schedule$
[error]   SolarSystemExample$

为什么会出现这种错误?我应该在哪里报告?

回答我自己的问题(对于任何有同样问题的人(:

确保类路径中没有scalajs-java-time(1.0.0(作为依赖项这是一个不完整的库,如果在scala-java-time之前选择它,您将收到问题中发布的错误。

出现此错误的原因是,至少在我的系统上,类路径的顺序从sbt1.2.8更改为SBT1.3.x,这导致scalajs-java-time库在scala-java-time之前被选中,从而导致

Referring to non-existent method java.time.LocalTime$.NANOS_PER_SECOND()long

错误

相关内容

  • 没有找到相关文章

最新更新