我正在使用Scala编程语言,并且尝试从中生成json
case class
。
我正在按照this页上的说明进行操作。我在pom.xml
<dependency>
<groupId>net.liftweb</groupId>
<artifactId>lift-json-scalaz7_2.12</artifactId>
<version>3.3.0</version>
</dependency>
我工作表中的代码是
import net.liftweb.json._
import net.liftweb.json.Serialization.write
case class Person(name: String, address: Address)
case class Address(city: String, state: String)
val p = Person("Alvin Alexander", Address("Talkeetna", "AK"))
implicit val formats = DefaultFormats
val jsonString = write(p)
println(jsonString)
我得到异常:“ java.lang.NoClassDefFoundError: Could not initialize class net.liftweb.json.DefaultFormats$
”
这里可能出什么问题了?
谢谢