scala - Parboiled2 导致 "missing or invalid dependency detected while loading class file ' Prepender.class'"

标签 scala sbt spray sbt-assembly parboiled

因此,最近几周我一直在尝试使用 parboiled2,这可能是我一生中遇到的最难添加到构建中的依赖项。我当前的错误是编译 sbt assembly ) 错误:

[error] missing or invalid dependency detected while loading class file 'Prepender.class'.
[error] Could not access type PrependAux in package shapeless,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'Prepender.class' was compiled against an incompatible version of shapeless.
[error] .../Main.scala:56: could not find implicit value for parameter prepender: spray.routing.Prepender[shapeless.HNil,shapeless.::[String,shapeless.HNil]]
[error]     path(searchSegment / Segment)(title => get(responder(complete(
[error]                        ^

似乎根本不可能让Spray 和Parboiled2 一起玩得很好。

我试过 sbt clean并删除我的 target目录。我的构建文件基本上是这样的:
resolvers ++= Seq(
  "spray repo" at "http://repo.spray.io"
)

val akkaV = "2.3.6"
val sprayV = "1.3.2"

libraryDependencies ++= Seq(
  // If I comment this line, everything works fine.
  "org.parboiled" %% "parboiled" % "2.0.1" withSources() withJavadoc(),
  //
  "org.scalacheck" %% "scalacheck" % "1.12.1" % "test" withSources() withJavadoc(),
  "org.specs2" %% "specs2-core" % "2.4.15" % "test" withSources() withJavadoc(),
  "org.specs2" %% "specs2-scalacheck" % "2.4.15" % "test" withSources() withJavadoc(),
  "org.scalaz" %% "scalaz-core" % "7.1.0" withSources() withJavadoc(),
  //
  "io.spray" %% "spray-json" % "1.3.1" withSources() withJavadoc(),
  "io.spray" %% "spray-can" % sprayV withSources() withJavadoc(),
  "io.spray" %% "spray-routing" % sprayV withSources() withJavadoc(),
  "io.spray" %% "spray-testkit" % sprayV  % "test" withSources() withJavadoc(),
  //
  "com.typesafe.akka" %% "akka-actor" % akkaV withSources() withJavadoc(),
  "com.typesafe.akka" %% "akka-testkit" % akkaV % "test" withSources() withJavadoc()
)

scalaVersion := "2.11.4"

javaOptions ++= Seq("-target", "1.8", "-source", "1.8")

我的 sbtVersion是 0.13.6,而我的 sbt-assembly版本是 0.12.0

在升级到 2.11 并升级我的 specs2 依赖项之前,我得到了:parboiled2 and Spray cause conflicting cross-version suffixes

最佳答案

如果你想使用 shapeless2 你需要依赖 spray-routing-shapeless2而不是 spray-routing .

请参阅示例依赖声明:

https://github.com/spray/spray-template/blob/on_spray-can_1.3_shapeless2_scala-2.11/build.sbt

关于scala - Parboiled2 导致 "missing or invalid dependency detected while loading class file ' Prepender.class'",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27942110/

相关文章:

android - 使用 Scala 在 Android 上使用 Google map

akka - Windows 上 akka.io.pinned-dispatcher 的高 CPU

scala - 在 Scala 中一次(逐行)读取 2 个文件

java - play2 framework 我的模板没见过。 : package views. html不存在

scala - 由正确类型限制的类型构造函数

dependencies - 如何解决 SBT 依赖的依赖冲突?

scala - 将 native 系统库与 SBT 集成

scala - 喷雾路由模板不起作用

scala - 喷拒不转换为状态码?

scala - Monix Observable groupBy 大量没有内存泄漏的键