Conflicting cross-version suffixes in: org.scalamacros:quasiquotes

有些话、适合烂在心里 提交于 2019-12-12 14:24:48

问题


I am trying to use scala-pickling in one of my projects. I tried to mimic the build file of macroid which seems to use pickling too but I keep getting this error on sbt test:

[error] Modules were resolved with conflicting cross-version suffixes in dijon:
[error]    org.scalamacros:quasiquotes _2.10, _2.10.3
java.lang.RuntimeException: Conflicting cross-version suffixes in: org.scalamacros:quasiquotes
    at scala.sys.package$.error(package.scala:27)
    at sbt.ConflictWarning$.processCrossVersioned(ConflictWarning.scala:47)
    at sbt.ConflictWarning$.apply(ConflictWarning.scala:30)
    at sbt.Classpaths$$anonfun$61.apply(Defaults.scala:1044)
    at sbt.Classpaths$$anonfun$61.apply(Defaults.scala:1044)

Full build log is here. What am I doing wrong? What should I change in my build.sbt to fix this? I also should be able to cross compile and release my library against both 2.10.x and 2.11.x.


回答1:


Starting from 2.0.0-M7, org.scalamacros % quasiquotes are cross-versioned as binary (i.e. _2.10) and not as full (i.e. _2.10.x): http://scalamacros.org/news/2014/04/03/macro-paradise-2.0.0-M7.html. Looks like one of your dependencies uses pre-M7 quasiquotes and another one uses post-M7 quasiquotes.

I don't think this can fixed in any way other than upgrading all the dependencies that use the old quasiquote library, because pre-M7 and post-M7 quasiquote libraries are incompatible.




回答2:


The problem is that you are using two different versions of the quasiquotes module that allows defining Scala macros. You should make sure that only a single version is used, and that this single version is matched by all your dependencies that use macros.

Also, are you sure that scala-pickling was released for Scala 2.11.x? Judging, from their build file, they released only for 2.10.3 - https://github.com/scala/pickling/blob/2.10.x/project/Build.scala#L10.

First, try to remove:

crossScalaVersions := Seq("2.10.4", "2.11.0-RC4")

And try again. After that, set the Scala version to 2.10.3, so that it matches the one in scala-pickling.

scalaVersion := "2.10.3"

EDIT: See Eugene's answer below for a more detailed explanation.




回答3:


According to my dependencyGraph from pulling in spray-testkit_2.10-1.3.2, specs2_2.10 v1.3.10 is still using a milestone release of quasiquotes. I ran the cross version error issue because of this.



来源:https://stackoverflow.com/questions/23149443/conflicting-cross-version-suffixes-in-org-scalamacrosquasiquotes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!