Parboiled2 导致“加载类文件‘Prepender.class’时检测到缺失或无效的依赖项"; [英] Parboiled2 causes "missing or invalid dependency detected while loading class file 'Prepender.class'"

查看:43
本文介绍了Parboiled2 导致“加载类文件‘Prepender.class’时检测到缺失或无效的依赖项";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

So I've been trying to use parboiled2 for the last few weeks now, it is possibly the most difficult dependency to add to a build I have come across in my entire life. My current error is a compile sbt assembly) error:

[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一起玩得很好.

It seems that it is simply impossible to make Spray and Parboiled2 play nice together.

我尝试过 sbt clean 并删除我的 target 目录.我的构建文件基本上是这样的:

I've tried sbt clean and removing my target directories. My build file is basically this:

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

My sbtVersion is 0.13.6, and my sbt-assembly version is 0.12.0

在升级到 2.11 并升级我的 specs2 依赖项之前,我得到了:parboiled2和 Spray 导致冲突的跨版本后缀

Before upgrading to 2.11 and upgrading my specs2 dependencies I got: parboiled2 and Spray cause conflicting cross-version suffixes

推荐答案

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

If you want to use shapeless2 you need to depend on spray-routing-shapeless2 instead of spray-routing.

查看示例依赖声明:

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

这篇关于Parboiled2 导致“加载类文件‘Prepender.class’时检测到缺失或无效的依赖项";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆