Reputation: 33
I am new to Scala & IntelliJ. I am trying to write a JSON program but it has compile errors below. I am using json4s-core_2.9.1-3.0.0
.
Error:(37, 14) Class com.fasterxml.jackson.core.JsonParseException not found - continuing with a stub. Error:(37, 14) Class com.fasterxml.jackson.core.JsonProcessingException not found - continuing with a stub. Error:(37, 14) Class com.fasterxml.jackson.core.JsonGenerationException not found - continuing with a stub.
In my set file, I have:
scalaVersion := "2.12.4"
libraryDependencies += "org.json4s" %% "json4s-jackson" % "{latestVersion}"
libraryDependencies += "com.fasterxml.jackson.core" % "jackson.core" % "{latestVersion}"
libraryDependencies += "com.fasterxml.jackson.core" % "JsonParseException" % "{latestVersion}"
libraryDependencies += "com.fasterxml.jackson.core" % "JsonProcessingException" % "{latestVersion}"
libraryDependencies += "com.fasterxml.jackson.core" % "JsonGenerationException" % "{latestVersion}"
What could go wrong? Any idea is appreciated. Thank you!
Upvotes: 0
Views: 1440
Reputation: 4583
json4s-core_2.9.1-3.0.0
looks like a very dated version that works with Scala 2.9.1 but you are using Scala version 2.12.4. You need the most recent version of json4s
that works with Scala 2.12.4 (which, based on Maven is json4s 3.5.3). From the json4s
install instructions I think you just need the following in your build.sbt
file.
libraryDependencies ++= Seq(
"org.json4s" %% "json4s-jackson" % "{latestVersion}"
)
This should grab the latest version of json4s-core
automatically along with the json4s-jackson
libraries.
Upvotes: 1