0

我无法派生具有许多属性的案例类。奇怪的是,输出在 SBT 和 gradle 之间变化。在https://github.com/geoHeil/pureconfig-issue找到了一个最小的可重现示例,代码如下:

sbt

sbt compile
[error] Caused by: java.lang.ClassNotFoundException: scala.runtime.LazyRef

毕业典礼

./gradlew compileScala
ould not find implicit value for parameter reader: pureconfig.ConfigReader[Foo.XXX]
  pureconfig.ConfigReader[XXX]

对于代码:

object Foo extends App {
  println("here")

  case class MyNestedThing(foo: String)
  case class XXX(
                  a: String,
                  b: String,
                  c: String,
                  d: String,
                  e: String,
                  f: String,
                  g: String,
                  h: String,
                  i: String,
                  j: String,
                  k: String,
                  l: String,
                  m: String,
                  n: String,
                  o: String,
                  p: String,
                  q: String,
                  r: String,
                  s: String,
                  t: String,
                  u: String,
                  v: String,
                  w: String,
                  x: String,
                  y: String,
                  z: String,
                  aa: String,
                  ab: String,
                  ac: String,
                  ad: String,
                  ae: String,
                  af: String,
                  ag: String,
                  ah: String,
                  ai: String,
                  aj: String,
                  ak: String,
                  al: String,
                  am: String,
                  an: String,
                  ao: String,
                  ap: String,
                  aq: String,
                  someLonglllllllllllllllllllllllllll: String,
                  so1meLonglllllllllllllllllllllllllll: String,
                  som2eLonglllllllllllllllllllllllllll: String,
                  ar: MyNestedThing,
                  as: MyNestedThing
                )

  pureconfig.ConfigReader[XXX]
}

虽然在使用时工作得很好:

object Foo extends App {
  println("here")

  case class MyNestedThing(foo: String)

  case class XXX(
                  a: String,
                  b: String,
                  som2eLonglllllllllllllllllllllllllll: String,
                  ar: MyNestedThing,
                  as: MyNestedThing
                )

  pureconfig.ConfigReader[XXX]
}

编辑

有趣的是,我在 scala 版本中有一个混淆,所以当将它修复为所有 2.11 SBT 编译正常,但 gradle 仍然显示同样的问题。

4

1 回答 1

0

当为 scala 编译器提供更多内存时,它可以正常工作。 https://github.com/pureconfig/pureconfig/issues/391

tasks.withType(ScalaCompile) {
    configure(scalaCompileOptions.forkOptions) {
        jvmArgs = ["-Xss2m"]
    }
}
于 2018-07-03T07:39:26.710 回答