关于Scala sbt库依赖关系:scala sbt库依赖关系-找不到模块错误

Scala sbt library dependency - module not found error

我正在尝试向json4添加依赖项,但出现模块未找到错误。我正在使用scala版本2.12.4和sbt版本1.1.1。我其他依赖项的添加似乎是以正常方式添加的。

这是我在build.sbt中的代码:

1
2
3
4
5
6
7
8
9
scalaVersion :="2.12.4"

libraryDependencies +="io.spray" %%"spray-json" %"1.3.4"

libraryDependencies +="org.scalatest" %%"scalatest" %"3.0.4" % Test

libraryDependencies +="org.scalacheck" %%"scalacheck" %"1.13.4" % Test

libraryDependencies +="org.json4s" %%"json4s-native" %"3.3.0"

这是我收到的错误消息:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[warn]  module not found: org.json4s#json4s-native_2.12;3.3.0
[warn] ==== local: tried
[warn]   /Users/*****/.ivy2/local/org.json4s/json4s-native_2.12/3.3.0/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/org/json4s/json4s-native_2.12/3.3.0/    json4s-native_2.12-3.3.0.pom
[warn] ==== local-preloaded-ivy: tried
[warn]   /Users/*****/.sbt/preloaded/org.json4s/json4s-native_2.12/3.3.0/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn]   file:////Users/*****/.sbt/preloaded/org/json4s/json4s-native_2.12/3.3.0/    json4s-native_2.12-3.3.0.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.json4s#json4s-native_2.12;3.3.0: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

感谢您的帮助,谢谢!


您需要使用此库的较新版本。

尝试一下:

libraryDependencies +="org.json4s" %%"json4s-native" %"3.6.0-M3"

或某些早期版本,但不是3.3.0

版本链接:
http://search.maven.org/#search|ga|2|g:" org.json4s"

编辑:此问题与兼容性有关。您使用新版本的Scala和sbt。该库的先前版本与此Scala版本或sbt版本不兼容。