我正在尝试将parboiled2作为一个依赖项添加到我的项目中,并遵循Calculator的示例,但它与喷雾冲突。
我当前的build.sbt文件包括:
"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(),当我加上
"org.parboiled" %% "parboiled" % "2.0.1" withSources() withJavadoc(),我得到了
[error] Modules were resolved with conflicting cross-version suffixes in {file:/blar/blar}blar-blar:
[error] com.chuusai:shapeless _2.10.4, _2.10
[error] org.scalamacros:quasiquotes _2.10, _2.10.3
java.lang.RuntimeException: Conflicting cross-version suffixes in: com.chuusai:shapeless, org.scalamacros:quasiquotes一些谷歌用户也这么做了,和往常一样,人们建议使用SBT的exclude指令(我认为这是不合逻辑的,因为它不可避免地会导致像ClassNotFoundException和NoSuchMethodError这样的问题)。尽管如此,我还是尝试过:
"org.parboiled" %% "parboiled" % "2.0.1" withSources() withJavadoc()
exclude("com.chuusai", "shapeless_2.10.4") exclude("org.scalamacros", "quasiquotes_2.10")当我尝试运行assembly时,我得到了惊喜
[error] java.lang.ClassNotFoundException: scala.quasiquotes.QuasiquoteCompat$我还得到了更多的错误:
[error] bad symbolic reference
. A signature in RuleDSLBasics.class refers to term internal
[error] in package scala.reflect which is not available.
[error] It may be completely missing from the current classpath, or the version on
[error] the classpath might be incompatible with the version used when compiling RuleDSLBasics.class.
[error] error while loading RuleDSLBasics, Missing dependency 'bad symbolic reference. A signature in RuleDSLBasics.class refers to term annotations
[error] in value scala.reflect.internal which is not available.
[error] It may be completely missing from the current classpath, or the version on
[error] the classpath might be incompatible with the version used when compiling RuleDSLBasics.class.', required by ...如果我注释掉喷雾依赖项(和代码),我可以使用Calculator示例成功地组装一个jar。
这是我使用parboiled2的一个主要的节目停止。除了exclude指令之外,还有其他方法可以让这些东西正常工作吗?有没有人有一个工作的构建文件与喷雾和parboiled2?如果有人已经设法绕过依赖地狱与一个has或ProGuard,我会喜欢它,如果他们可以解释一下如何。
更新:
我的构建文件:
resolvers ++= Seq(
"Concurrent Maven Repo" at "http://conjars.org/repo",
"spray repo" at "http://repo.spray.io"
)
val akkaV = "2.3.6"
val sprayV = "1.3.2"
libraryDependencies ++= Seq(
"org.parboiled" %% "parboiled" % "2.0.1" withSources() withJavadoc(),
// Causes org.scalamacros:quasiquotes _2.10, _2.10.3 cross-version problem
"io.spray" %% "spray-testkit" % sprayV % "test" withSources() withJavadoc(),
// Causes com.chuusai:shapeless _2.10.4, _2.10 cross-version problem
"io.spray" %% "spray-routing" % sprayV withSources() withJavadoc()
)
scalaVersion := "2.10.4"
javaOptions ++= Seq("-target", "1.8", "-source", "1.8")
organization := domain + "." + companyName插件文件:
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.12.0")
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")Scala 2.11
移动2.11似乎“简单”地解决了这个问题,但是如果有一些没有准备好的其他库,这并不总是那么容易。尽管如此,我还是尝试了一下,第二次我添加了parboiled2作为依赖,它再次破坏了我的构建,叹息,这是一个新的问题:Parboiled2 causes "missing or invalid dependency detected while loading class file 'Prepender.class'"
发布于 2015-01-14 12:58:23
同样的answer as for Scala 2.11也应该在这里工作:用spray-routing-shapeless2替换spray-routing。
发布于 2014-12-28 15:14:36
我需要查看整个build.sbt文件来了解发生了什么,但是我可以使用您提到的依赖项,而不是SBT0.13.7和Scala2.11。
什么sbt版本?什么Scala版本?看上去是2.10。为什么?你还坚持那些版本吗?
作为参考,下面是我用来测试这个场景的build.sbt、plugins.sbt和build.properties文件。
https://gist.github.com/fedesilva/ddd28a5b592eb88f41ae
希望这有帮助
https://stackoverflow.com/questions/27658468
复制相似问题