Conflicting cross-version suffixes (sbt, Scala-STM, Play-JSON)
Asked Answered
U

3

21

I am using a JSON extension which relies on Mandubian's play-json 2.2-SNAPSHOT. Everything worked fine until now I have a project based on Scala-STM. sbt reports the following problem:

[error] Modules were resolved with conflicting cross-version suffixes 
        in {file:folder}project:
[error]    org.scala-stm:scala-stm _2.10, _2.10.0
java.lang.RuntimeException: Conflicting cross-version suffixes in: 
  org.scala-stm:scala-stm

Is there any chance to dig deeper into where these two "conflicting" versions come from? I am quite surprised that play-json should be depending on scala-stm?!

Furthermore, is there a way to convince sbt to shut the ... up. Because obviously 2.10 and 2.10.0 are equivalent versions.


EDIT: This seems to be an sbt 0.13 bug (and probably has nothing to do with Play-JSON), because if I revert to 0.12.4, the project successfully updates and builds. I am still interested in a work around for sbt 0.13.

Understructure answered 8/10, 2013 at 8:12 Comment(2)
Rather than use Mandubian's play-json SNAPSHOT, why not just add this dependency - "play % "play_2.10" % "2.1.0" per my question - #19436569Aluin
I am not sure it is a bug. I saw this problem too after upgrading, but then discovered that there were indeed two different versions of a library being used. It might be useful to turn it down to a warning I guess.Osculate
K
21

You can get around this by removing scala-stm with exclude

 "dependencyGroupId" %% "dependencyArtifactId" % "dependencyVersion" exclude("org.scala-stm", "scala-stm_2.10.0")

Do not forget to do sbt clean.

Koster answered 8/10, 2013 at 8:37 Comment(5)
Where do I add this in my play app? I presume Build.scala, but where inside of it?Aluin
Build.scala for a newly created project (Play 2.1.x, as 2.2 does not use Build.scala anymore) contains variable val appDependencies that contains a Seq with dependencies. Right inside of it.Koster
@kompot, Play 2.2 and 2.3 can be used with either build.sbt or Build.scala.Springhouse
What exactly does exclude do, it seems to be a catch all solution to when sbt is being a moron. Surely there has to be some consequences?Perspicuity
exclude is described in scala-sbt.org/0.13/docs/Library-Management.htmlLaylalayman
J
2

Updated Play2 2.2 - downgrading to SBT from 0.13.0 -> 0.12.4 didn't work with me, but excluding using exclude("org.scala-stm", "scala-stm_2.10.0") on ALL app-specific dependencies I had worked fine -- anyway -- none of my dependencies shouldn't have anything to do with scala-stm.

Joaquinajoash answered 8/10, 2013 at 13:45 Comment(2)
So are you saying you had the same issue with Play 2.2?Understructure
Exactly. Problem occured when I was switching from Play2 2.1 to 2.2, before that all was fine with 0.12.4 and Play2 2.1Joaquinajoash
M
2

If you'd like to see all libraries being pulled in to your SBT project, you can use the SBT dependency graph plugin.

Using this, you can see why scala-stm is being pulled in, and also check for other conflicting scala 2.10 and 2.11 dependencies.

Malia answered 29/8, 2014 at 6:37 Comment(3)
Thanks, I have this plugin now globally installed and use it a lot. A good recommendation.Understructure
that would be nice. but this plugin didnt work for me: "cannot resolve symbol virtual" in the line net.virtualvoid.sbt.graph.Plugin.graphSettings Gallicanism
@Gallicanism That line should be in /build.sbt instead of /project/build.sbt. Is that the case in your build? Or use the alternative approach mentioned here: github.com/jrudolph/sbt-dependency-graph#how-to-useMalia

© 2022 - 2024 — McMap. All rights reserved.