我无法派生具有许多属性的案例类。奇怪的是,输出在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仍然显示相同的问题。
最佳答案
当为scala编译器提供更多内存时,它可以正常工作。
https://github.com/pureconfig/pureconfig/issues/391
tasks.withType(ScalaCompile) {
configure(scalaCompileOptions.forkOptions) {
jvmArgs = ["-Xss2m"]
}
}