我正在尝试在我的scala项目中使用scala解析器组合器。
我项目中唯一的.sbt
文件是 project / build.sbt :
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.4"
我尝试将此行添加到 build / project.sbt
resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"
但是我得到了完全相同的错误。
当我从项目根目录中的终端执行sbt
时,我获得了以下依赖性错误(这些是错误之前的最后一行):
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-lang.modules#scala-parser-combinators_2.10;1.0.4: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] org.scala-lang.modules:scala-parser-combinators_2.10:1.0.4 (/home/simonlbc/workspace/examslenstra/project/build.sbt#L7-8)
[warn] +- default:examslenstra-build:0.1-SNAPSHOT (scalaVersion=2.10, sbtVersion=0.13)
sbt.ResolveException: unresolved dependency: org.scala-lang.modules#scala-parser-combinators_2.10;1.0.4: not found
[error] (*:update) sbt.ResolveException: unresolved dependency: org.scala-lang.modules#scala-parser-combinators_2.10;1.0.4: not found
有几行似乎是从sbt尝试解决几个不同存储库中的插件:
[warn] module not found: org.scala-lang.modules#scala-parser-combinators_2.10;1.0.4
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/org.scala-lang.modules/scala-parser-combinators_2.10/1.0.4/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.scala-lang.modules/scala-parser-combinators_2.10/1.0.4/ivys/ivy.xml
[warn] ==== local: tried
[warn] /home/simonlbc/.ivy2/local/org.scala-lang.modules/scala-parser-combinators_2.10/1.0.4/ivys/ivy.xml
[warn] ==== activator-launcher-local: tried
[warn] /home/simonlbc/.activator/repository/org.scala-lang.modules/scala-parser-combinators_2.10/1.0.4/ivys/ivy.xml
[warn] ==== activator-local: tried
[warn] /home/simonlbc/workspace/DB/DB2016/server/activator-dist-1.3.10/repository/org.scala-lang.modules/scala-parser-combinators_2.10/1.0.4/ivys/ivy.xml
[warn] ==== typesafe-releases: tried
[warn] http://repo.typesafe.com/typesafe/releases/org/scala-lang/modules/scala-parser-combinators_2.10/1.0.4/scala-parser-combinators_2.10-1.0.4.pom
[warn] ==== typesafe-ivy-releasez: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/org.scala-lang.modules/scala-parser-combinators_2.10/1.0.4/ivys/ivy.xml
[warn] ==== sbt-releases-repo: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/org.scala-lang.modules/scala-parser-combinators_2.10/1.0.4/ivys/ivy.xml
[warn] ==== sbt-plugins-repo: tried
[warn] http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.scala-lang.modules/scala-parser-combinators_2.10/1.0.4/ivys/ivy.xml
[warn] ==== maven-central: tried
[warn] http://repo1.maven.org/maven2/org/scala-lang/modules/scala-parser-combinators_2.10/1.0.4/scala-parser-combinators_2.10-1.0.4.pom
[warn] ==== Typesafe Repo: tried
[warn] http://repo.typesafe.com/typesafe/releases/org/scala-lang/modules/scala-parser-combinators_2.10/1.0.4/scala-parser-combinators_2.10-1.0.4.pom
要编写我的 project / build.sbt 文件,我遵循了scala解析器组合器github repository给出的指令。
当然,当我没有在 project / build.sbt 中指定任何内容时,我从sbt得到编译时错误,这不能理解Parser类源文件的位置。
我是否可以配置 project / build.sbt 以便我可以使用Scala的解析器组合库?
答案 0 :(得分:5)
基于这部分错误:
[warn] Note: Unresolved dependencies path:
[warn] org.scala-lang.modules:scala-parser-combinators_2.10:1.0.4
^
看起来你正在使用Scala 2.10,其中解析器组合器是标准库的一部分。从Scala 2.11开始,它们从标准库中分离出来,因此您正在寻找的jar不存在。如果您坚持使用2.10,只需删除该依赖项,您就可以在标准库中获取它。