未找到Intellij Scala类路径

时间:2017-12-06 08:20:53

标签: scala intellij-idea

我正在尝试使用json4s,但在编译时我一直收到以下错误。我以为图书馆内部会有这个课程。我使用的是json4s-ast_2.11-4.0.0-M1.jarjson4s-core_2.12.3.5.3.jarjson4s-jackson_2.9.1-3.0.0.jar

Error:(64, 25) Symbol 'type org.json4s.JsonAST.JValue' is missing from the classpath.
This symbol is required by 'type org.json4s.JValue'.
Make sure that type JValue is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
A full rebuild may help if 'package.class' was compiled against an incompatible version of org.json4s.JsonAST.

进口:

import org.json4s.jackson.JsonMethods._
import org.json4s._

build.sbt

scalaVersion := "2.12.4"
libraryDependencies += "org.json4s" %% "json4s-jackson" % "3.0.0"
libraryDependencies += "org.json4s" %% "json4s-ast" % "4.0.0-M1"
libraryDependencies += "org.json4s" %% "json4s-core" % "3.5.3"

1 个答案:

答案 0 :(得分:2)

在其他版本中,不能使用为不同版本的scala编译的库。您需要修复JSON4的版本控制。看看:

http://www.scala-sbt.org/0.13/docs/Cross-Build.html#Using+Cross-Built+Libraries